├── .gitignore
├── .travis.yml
├── LICENSE
├── Makefile
├── README.md
├── bin
└── pear-package.php
├── composer.json
├── composer.lock
├── library
└── Respect
│ └── Loader.php
├── package.xml
├── phpunit.xml
└── tests
├── bootstrap.php
├── fixtures
├── Pear
│ └── Fixture
│ │ └── Example.php
└── Psr0
│ └── Fixture
│ └── Example.php
└── library
└── LoaderTest.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .buildpath
2 | .project
3 | .settings/
4 | tests/reports
5 | vendor
6 | pirum
7 | nbproject
8 | *.7z
9 | *.jar
10 | *.rar
11 | *.zip
12 | *.gz
13 | *.bzip
14 | *.xz
15 | *.lzma
16 | *.iso
17 | *.tar
18 | *.dmg
19 | *.xpi
20 | *.gem
21 | *.egg
22 | *.deb
23 | *.rpm
24 | *.tgz
25 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | php:
3 | - 5.3
4 | - 5.4
5 | - 5.5
6 |
7 | before_script:
8 | - composer install --dev
9 |
10 | script:
11 | - vendor/bin/phpunit -v
12 |
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | License Information
2 | ===================
3 |
4 | Copyright (c) 2009-2012, Alexandre Gomes Gaigalas.
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without modification,
8 | are permitted provided that the following conditions are met:
9 |
10 | * Redistributions of source code must retain the above copyright notice,
11 | this list of conditions and the following disclaimer.
12 |
13 | * Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 |
17 | * Neither the name of Alexandre Gomes Gaigalas nor the names of its
18 | contributors may be used to endorse or promote products derived from this
19 | software without specific prior written permission.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | default:
2 | @echo "Respect Foundation"
3 | @echo 'Please see "make help" for instructions'
4 |
5 | help:
6 | @echo "Respect Foundation\n"
7 | @echo "Available targets:"
8 | @echo "help\t\t This message"
9 | @echo "test\t\t Run all tests"
10 | @echo "coverage\t Run all tests and write HTML coverage reports"
11 | @echo "dev\t\t Install the necessary packages to develop this project"
12 | @echo "patch\t\t Updates the package.xml and increments the patch revision number (1.1.x)"
13 | @echo "minor\t\t Updates the package.xml and increments the minor revision number (1.x.0)"
14 | @echo "major\t\t Updates the package.xml and increments the major revision number (x.0.0)"
15 | @echo "pear\t\t Creates a PEAR package from the current package.xml"
16 | @echo "pirum-push\t PKG=FooPackage.tgz REPO=GitHubFooUser/GitHubFooRepo Send all tgz pear packages to Pirum repository (requires git write access)"
17 |
18 | test:
19 | @cd tests;phpunit .
20 |
21 | coverage:
22 | @cd tests;phpunit --coverage-html=reports/coverage .
23 | @echo "Done. Reports available on tests/reports/coverage/index.html"
24 |
25 | dev:
26 | @echo "Installing PEAR packages... (please run as root if needed)"
27 | pear upgrade
28 | pear config-set auto_discover 1
29 | -pear channel-discover respect.li/pear
30 | pear install --soft --force pear.phpunit.de/PHPUnit
31 | pear install --soft --force pear.pirum-project.org/Pirum
32 | pear install --soft --force --alldeps -o package.xml
33 |
34 | patch:
35 | @echo "Generating package.xml patch version"
36 | php bin/pear-package.php patch ${STABILITY}
37 |
38 | minor:
39 | @echo "Generating package.xml minor version"
40 | php bin/pear-package.php minor ${STABILITY}
41 |
42 | major:
43 | @echo "Generating package.xml major version"
44 | php bin/pear-package.php major ${STABILITY}
45 |
46 | pear:
47 | @echo "Generating package tgz"
48 | pear package package.xml
49 |
50 | pirum-push:
51 | @echo "Cloning channel from git ${REPO}"
52 | -rm -Rf pirum
53 | git clone git@github.com:${REPO}.git pirum
54 | pirum add pirum ${PKG};pirum build pirum;
55 | cd pirum;git add .;git commit -m "Added ${PKG}";git push
56 | @echo "Success! Pushed ${PKG}"
57 |
58 | foundation:
59 | @echo "Cloning Foundation from GitHub"
60 | -rm -Rf .foundation-tmp
61 | git clone git://github.com/Respect/Foundation.git .foundation-tmp
62 | @echo "Renaming .dist files and removing repo metadata"
63 | rm .foundation-tmp/README.md
64 | rm .foundation-tmp/LICENSE
65 | mv .foundation-tmp/README.md.dist .foundation-tmp/README.md
66 | mv .foundation-tmp/package.xml.dist package.xml
67 | @echo "Copying files without overwrite"
68 | cp -an .foundation-tmp/* .
69 | echo "Removing temp files"
70 | rm -Rf .foundation-tmp
71 | @echo "Done!"
72 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Respect\Loader
2 | ==============
3 |
4 | [](http://travis-ci.org/Respect/Loader) [](https://packagist.org/packages/respect/loader) [](https://packagist.org/packages/respect/loader) [](https://packagist.org/packages/respect/loader) [](https://packagist.org/packages/respect/loader)
5 |
6 | A simple, minimalist class loader that implements the PSR-0 spec.
7 |
8 | Configuration
9 | -------------
10 |
11 | Respect\Loader needs the include_path properly configured. Add your library to
12 | the include_path directive in php.ini or set up in runtime like this:
13 |
14 | ```php
15 | contents->dir['name'];
15 | $target = realpath("../$dir_name");
16 | $base_install_dir = (string) $package_data->contents->dir['baseinstalldir'];
17 | unset($package_data->contents->dir);
18 | $main_dir = $package_data->contents->addChild('dir');
19 | $main_dir['name'] = $dir_name;
20 | $main_dir['baseinstalldir'] = $base_install_dir;
21 |
22 | foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($target), RecursiveIteratorIterator::LEAVES_ONLY) as $php_file) {
23 | $file = $main_dir->addChild('file');
24 | $file['role'] = 'php';
25 | $file['baseinstalldir'] = $base_install_dir;
26 | $file['install-as'] = str_replace($target, '', $php_file);
27 | $file['name'] = $dir_name . $file['install-as'];
28 | }
29 |
30 | $package_data->date = date('Y-m-d');
31 | $package_data->time = date('H:i:s');
32 | $current_version = $package_data->version->release;
33 | list($major_version, $minor_version, $patch_version) = explode('.', $current_version);
34 |
35 | if (isset($$version_type))
36 | $$version_type++;
37 | else
38 | $patch_version++;
39 |
40 | switch ($version_type) {
41 | case 'major_version':
42 | $minor_version = 0;
43 | case 'minor_version':
44 | $patch_version = 0;
45 | }
46 |
47 | $changelog = $package_data->changelog->addChild('release');
48 |
49 | $package_version = "$major_version.$minor_version.$patch_version";
50 | $stability = $stability ? : $package_data->stability->release;
51 |
52 | $changelog->version->api
53 | = (string) $changelog->version->release
54 | = (string) $package_data->version->api
55 | = (string) $package_data->version->release
56 | = (string) $package_version;
57 | $changelog->stability->api
58 | = (string) $changelog->stability->release
59 | = (string) $package_data->stability->api
60 | = (string) $package_data->stability->release
61 | = (string) $stability;
62 | $changelog->license = $package_data->license;
63 | $changelog->license['uri'] = $package_data->license['uri'];
64 |
65 | $dom = new DOMDocument('1.0');
66 | $dom->preserveWhiteSpace = false;
67 | $dom->formatOutput = true;
68 | $dom->loadXML($package_data->asXML());
69 | $dom->save($package_xml_file);
70 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Respect/Loader",
3 | "description": "Minimalistic Autoloader, PSR-0 complient.",
4 | "type": "library",
5 | "keywords": ["PSR-0", "autoload", "autoloader", "loader"],
6 | "homepage": "http://respect.li",
7 | "license": "BSD Style",
8 | "authors": [
9 | {
10 | "name": "Respect/Loader Constributors",
11 | "homepage": "http://github.com/Respect/Loader/contributors"
12 | }
13 | ],
14 | "require-dev": {
15 | "phpunit/phpunit": "3.7.*"
16 | },
17 | "autoload": {
18 | "psr-0": {
19 | "Respect\\Loader": "library\/"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
5 | ],
6 | "hash": "7e25905951ee72d90717775a212ed15a",
7 | "packages": [
8 |
9 | ],
10 | "packages-dev": [
11 | {
12 | "name": "phpunit/php-code-coverage",
13 | "version": "1.2.13",
14 | "source": {
15 | "type": "git",
16 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
17 | "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94"
18 | },
19 | "dist": {
20 | "type": "zip",
21 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
22 | "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
23 | "shasum": ""
24 | },
25 | "require": {
26 | "php": ">=5.3.3",
27 | "phpunit/php-file-iterator": ">=1.3.0@stable",
28 | "phpunit/php-text-template": ">=1.1.1@stable",
29 | "phpunit/php-token-stream": ">=1.1.3@stable"
30 | },
31 | "require-dev": {
32 | "phpunit/phpunit": "3.7.*@dev"
33 | },
34 | "suggest": {
35 | "ext-dom": "*",
36 | "ext-xdebug": ">=2.0.5"
37 | },
38 | "type": "library",
39 | "extra": {
40 | "branch-alias": {
41 | "dev-master": "1.2.x-dev"
42 | }
43 | },
44 | "autoload": {
45 | "classmap": [
46 | "PHP/"
47 | ]
48 | },
49 | "notification-url": "https://packagist.org/downloads/",
50 | "include-path": [
51 | ""
52 | ],
53 | "license": [
54 | "BSD-3-Clause"
55 | ],
56 | "authors": [
57 | {
58 | "name": "Sebastian Bergmann",
59 | "email": "sb@sebastian-bergmann.de",
60 | "role": "lead"
61 | }
62 | ],
63 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
64 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
65 | "keywords": [
66 | "coverage",
67 | "testing",
68 | "xunit"
69 | ],
70 | "time": "2013-09-10 08:14:32"
71 | },
72 | {
73 | "name": "phpunit/php-file-iterator",
74 | "version": "1.3.4",
75 | "source": {
76 | "type": "git",
77 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
78 | "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
79 | },
80 | "dist": {
81 | "type": "zip",
82 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
83 | "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
84 | "shasum": ""
85 | },
86 | "require": {
87 | "php": ">=5.3.3"
88 | },
89 | "type": "library",
90 | "autoload": {
91 | "classmap": [
92 | "File/"
93 | ]
94 | },
95 | "notification-url": "https://packagist.org/downloads/",
96 | "include-path": [
97 | ""
98 | ],
99 | "license": [
100 | "BSD-3-Clause"
101 | ],
102 | "authors": [
103 | {
104 | "name": "Sebastian Bergmann",
105 | "email": "sb@sebastian-bergmann.de",
106 | "role": "lead"
107 | }
108 | ],
109 | "description": "FilterIterator implementation that filters files based on a list of suffixes.",
110 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
111 | "keywords": [
112 | "filesystem",
113 | "iterator"
114 | ],
115 | "time": "2013-10-10 15:34:57"
116 | },
117 | {
118 | "name": "phpunit/php-text-template",
119 | "version": "1.1.4",
120 | "source": {
121 | "type": "git",
122 | "url": "https://github.com/sebastianbergmann/php-text-template.git",
123 | "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23"
124 | },
125 | "dist": {
126 | "type": "zip",
127 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23",
128 | "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23",
129 | "shasum": ""
130 | },
131 | "require": {
132 | "php": ">=5.3.3"
133 | },
134 | "type": "library",
135 | "autoload": {
136 | "classmap": [
137 | "Text/"
138 | ]
139 | },
140 | "notification-url": "https://packagist.org/downloads/",
141 | "include-path": [
142 | ""
143 | ],
144 | "license": [
145 | "BSD-3-Clause"
146 | ],
147 | "authors": [
148 | {
149 | "name": "Sebastian Bergmann",
150 | "email": "sb@sebastian-bergmann.de",
151 | "role": "lead"
152 | }
153 | ],
154 | "description": "Simple template engine.",
155 | "homepage": "https://github.com/sebastianbergmann/php-text-template/",
156 | "keywords": [
157 | "template"
158 | ],
159 | "time": "2012-10-31 18:15:28"
160 | },
161 | {
162 | "name": "phpunit/php-timer",
163 | "version": "1.0.5",
164 | "source": {
165 | "type": "git",
166 | "url": "https://github.com/sebastianbergmann/php-timer.git",
167 | "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
168 | },
169 | "dist": {
170 | "type": "zip",
171 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
172 | "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
173 | "shasum": ""
174 | },
175 | "require": {
176 | "php": ">=5.3.3"
177 | },
178 | "type": "library",
179 | "autoload": {
180 | "classmap": [
181 | "PHP/"
182 | ]
183 | },
184 | "notification-url": "https://packagist.org/downloads/",
185 | "include-path": [
186 | ""
187 | ],
188 | "license": [
189 | "BSD-3-Clause"
190 | ],
191 | "authors": [
192 | {
193 | "name": "Sebastian Bergmann",
194 | "email": "sb@sebastian-bergmann.de",
195 | "role": "lead"
196 | }
197 | ],
198 | "description": "Utility class for timing",
199 | "homepage": "https://github.com/sebastianbergmann/php-timer/",
200 | "keywords": [
201 | "timer"
202 | ],
203 | "time": "2013-08-02 07:42:54"
204 | },
205 | {
206 | "name": "phpunit/php-token-stream",
207 | "version": "1.2.1",
208 | "source": {
209 | "type": "git",
210 | "url": "https://github.com/sebastianbergmann/php-token-stream.git",
211 | "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e"
212 | },
213 | "dist": {
214 | "type": "zip",
215 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
216 | "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
217 | "shasum": ""
218 | },
219 | "require": {
220 | "ext-tokenizer": "*",
221 | "php": ">=5.3.3"
222 | },
223 | "type": "library",
224 | "extra": {
225 | "branch-alias": {
226 | "dev-master": "1.2-dev"
227 | }
228 | },
229 | "autoload": {
230 | "classmap": [
231 | "PHP/"
232 | ]
233 | },
234 | "notification-url": "https://packagist.org/downloads/",
235 | "include-path": [
236 | ""
237 | ],
238 | "license": [
239 | "BSD-3-Clause"
240 | ],
241 | "authors": [
242 | {
243 | "name": "Sebastian Bergmann",
244 | "email": "sb@sebastian-bergmann.de",
245 | "role": "lead"
246 | }
247 | ],
248 | "description": "Wrapper around PHP's tokenizer extension.",
249 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
250 | "keywords": [
251 | "tokenizer"
252 | ],
253 | "time": "2013-09-13 04:58:23"
254 | },
255 | {
256 | "name": "phpunit/phpunit",
257 | "version": "3.7.28",
258 | "source": {
259 | "type": "git",
260 | "url": "https://github.com/sebastianbergmann/phpunit.git",
261 | "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d"
262 | },
263 | "dist": {
264 | "type": "zip",
265 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d",
266 | "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d",
267 | "shasum": ""
268 | },
269 | "require": {
270 | "ext-dom": "*",
271 | "ext-pcre": "*",
272 | "ext-reflection": "*",
273 | "ext-spl": "*",
274 | "php": ">=5.3.3",
275 | "phpunit/php-code-coverage": "~1.2.1",
276 | "phpunit/php-file-iterator": ">=1.3.1",
277 | "phpunit/php-text-template": ">=1.1.1",
278 | "phpunit/php-timer": ">=1.0.4",
279 | "phpunit/phpunit-mock-objects": "~1.2.0",
280 | "symfony/yaml": "~2.0"
281 | },
282 | "require-dev": {
283 | "pear-pear/pear": "1.9.4"
284 | },
285 | "suggest": {
286 | "ext-json": "*",
287 | "ext-simplexml": "*",
288 | "ext-tokenizer": "*",
289 | "phpunit/php-invoker": ">=1.1.0,<1.2.0"
290 | },
291 | "bin": [
292 | "composer/bin/phpunit"
293 | ],
294 | "type": "library",
295 | "extra": {
296 | "branch-alias": {
297 | "dev-master": "3.7.x-dev"
298 | }
299 | },
300 | "autoload": {
301 | "classmap": [
302 | "PHPUnit/"
303 | ]
304 | },
305 | "notification-url": "https://packagist.org/downloads/",
306 | "include-path": [
307 | "",
308 | "../../symfony/yaml/"
309 | ],
310 | "license": [
311 | "BSD-3-Clause"
312 | ],
313 | "authors": [
314 | {
315 | "name": "Sebastian Bergmann",
316 | "email": "sebastian@phpunit.de",
317 | "role": "lead"
318 | }
319 | ],
320 | "description": "The PHP Unit Testing framework.",
321 | "homepage": "http://www.phpunit.de/",
322 | "keywords": [
323 | "phpunit",
324 | "testing",
325 | "xunit"
326 | ],
327 | "time": "2013-10-17 07:27:40"
328 | },
329 | {
330 | "name": "phpunit/phpunit-mock-objects",
331 | "version": "1.2.3",
332 | "source": {
333 | "type": "git",
334 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
335 | "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875"
336 | },
337 | "dist": {
338 | "type": "zip",
339 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875",
340 | "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875",
341 | "shasum": ""
342 | },
343 | "require": {
344 | "php": ">=5.3.3",
345 | "phpunit/php-text-template": ">=1.1.1@stable"
346 | },
347 | "suggest": {
348 | "ext-soap": "*"
349 | },
350 | "type": "library",
351 | "autoload": {
352 | "classmap": [
353 | "PHPUnit/"
354 | ]
355 | },
356 | "notification-url": "https://packagist.org/downloads/",
357 | "include-path": [
358 | ""
359 | ],
360 | "license": [
361 | "BSD-3-Clause"
362 | ],
363 | "authors": [
364 | {
365 | "name": "Sebastian Bergmann",
366 | "email": "sb@sebastian-bergmann.de",
367 | "role": "lead"
368 | }
369 | ],
370 | "description": "Mock Object library for PHPUnit",
371 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
372 | "keywords": [
373 | "mock",
374 | "xunit"
375 | ],
376 | "time": "2013-01-13 10:24:48"
377 | },
378 | {
379 | "name": "symfony/yaml",
380 | "version": "v2.4.0",
381 | "target-dir": "Symfony/Component/Yaml",
382 | "source": {
383 | "type": "git",
384 | "url": "https://github.com/symfony/Yaml.git",
385 | "reference": "1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5"
386 | },
387 | "dist": {
388 | "type": "zip",
389 | "url": "https://api.github.com/repos/symfony/Yaml/zipball/1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5",
390 | "reference": "1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5",
391 | "shasum": ""
392 | },
393 | "require": {
394 | "php": ">=5.3.3"
395 | },
396 | "type": "library",
397 | "extra": {
398 | "branch-alias": {
399 | "dev-master": "2.4-dev"
400 | }
401 | },
402 | "autoload": {
403 | "psr-0": {
404 | "Symfony\\Component\\Yaml\\": ""
405 | }
406 | },
407 | "notification-url": "https://packagist.org/downloads/",
408 | "license": [
409 | "MIT"
410 | ],
411 | "authors": [
412 | {
413 | "name": "Fabien Potencier",
414 | "email": "fabien@symfony.com"
415 | },
416 | {
417 | "name": "Symfony Community",
418 | "homepage": "http://symfony.com/contributors"
419 | }
420 | ],
421 | "description": "Symfony Yaml Component",
422 | "homepage": "http://symfony.com",
423 | "time": "2013-11-26 16:40:27"
424 | }
425 | ],
426 | "aliases": [
427 |
428 | ],
429 | "minimum-stability": "stable",
430 | "stability-flags": [
431 |
432 | ],
433 | "platform": [
434 |
435 | ],
436 | "platform-dev": [
437 |
438 | ]
439 | }
440 |
--------------------------------------------------------------------------------
/library/Respect/Loader.php:
--------------------------------------------------------------------------------
1 | findFileFromClassName($className);
24 | }
25 | }
26 |
27 | if (!defined('RESPECT_DO_NOT_RETURN_AUTOLOADER'))
28 | return new Loader;
29 |
--------------------------------------------------------------------------------
/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Loader
4 | respect.li/pear
5 | Hello. I love to load things.
6 | Hello. I love to load things.
7 |
8 | Alexandre Gomes Gaigalas
9 | alganet
10 | alexandre@gaigalas.net
11 | yes
12 |
13 | 2011-11-29
14 |
15 |
16 | 0.2.0
17 | 0.2.0
18 |
19 |
20 | alpha
21 | alpha
22 |
23 | BSD Style
24 |
25 | Hello. I love to load things.
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 5.3
36 |
37 |
38 | 1.4.0
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 0.1.1
47 | 0.1.1
48 |
49 |
50 | alpha
51 | alpha
52 |
53 | 2011-08-17
54 | BSD Style
55 |
56 | Hello. I love to load things.
57 |
58 |
59 |
60 |
61 | 0.1.2
62 | 0.1.2
63 |
64 |
65 | alpha
66 | alpha
67 |
68 | BSD Style
69 |
70 |
71 |
72 | 0.2.0
73 | 0.2.0
74 |
75 |
76 | alpha
77 | alpha
78 |
79 | BSD Style
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ./tests/library
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/bootstrap.php:
--------------------------------------------------------------------------------
1 | assertTrue(
23 | defined($constantName = 'ROOT_PATH'),
24 | sprintf('Expected constant "%s" to be declared. Was `tests/bootstrap.php` even loaded?!', $constantName)
25 | );
26 | $this->assertNotEmpty(
27 | ROOT_PATH,
28 | 'The ROOT_PATH constant (poiting to the root directory of the library) should not be empty.'
29 | );
30 | $this->assertTrue(
31 | defined($constantName = 'FIXTURE_PATH'),
32 | sprintf('Expected constant "%s" to be declared. Was `tests/bootstrap.php` even loaded?!', $constantName)
33 | );
34 | $this->assertContains(
35 | $fixturePath = constant($constantName),
36 | $includePath = $this->includePath = get_include_path(),
37 | sprintf('Class fixure path "%s" should be on PHP\'s include_path (%s).', $fixturePath, $includePath)
38 | );
39 |
40 | $this->assertTrue(
41 | class_exists($className = 'Respect\Loader'),
42 | sprintf('Expect to able to (at least) load class "%s" using Composer\'s autoload.',$className)
43 | );
44 | }
45 |
46 | public function setUp()
47 | {
48 | $this->autoloader = new Loader;
49 | $loaderReflection = new \ReflectionObject($this->autoloader);
50 | $this->loaderFilePath = $loaderReflection->getFileName();
51 | spl_autoload_register($this->autoloader);
52 | }
53 |
54 | public function tearDown()
55 | {
56 | spl_autoload_unregister($this->autoloader);
57 | }
58 |
59 | /**
60 | * @test
61 | */
62 | public function Loads_from_IncludePath_class_using_Pear_naming_convention()
63 | {
64 | $className = 'Pear_Fixture_Example';
65 | $this->assertFileExists(
66 | $fileName = $this->autoloader->findFileFromClassName($className),
67 | sprintf('Failed to find "%s" for class "%s" on include_path: %s', $fileName, $className, $this->includePath)
68 | );
69 | $this->assertInstanceOf(
70 | $className,
71 | new $className
72 | );
73 | }
74 |
75 | /**
76 | * @test
77 | */
78 | public function Loads_from_IncludePath_class_using_PSR0_naming_convention()
79 | {
80 | $className = 'Psr0\Fixture\Example';
81 | $this->assertFileExists(
82 | $fileName = $this->autoloader->findFileFromClassName($className),
83 | sprintf('Failed to find "%s" for class "%s" on include_path: %s', $fileName, $className, $this->includePath)
84 | );
85 | $this->assertInstanceOf(
86 | $className,
87 | new $className
88 | );
89 | }
90 |
91 | /**
92 | * @test
93 | */
94 | public function Class_is_callable()
95 | {
96 | $this->assertTrue(
97 | is_callable($this->autoloader),
98 | 'The instance should be callable.'
99 | );
100 | }
101 |
102 | /**
103 | * @test
104 | * @ runInSeparateProcess
105 | * @ preserveGlobalState disabled
106 | */
107 | public function Including_file_should_return_a_Loader_instance_by_default()
108 | {
109 | $this->markTestIncomplete('PHPUnit is fucking me around...');
110 | $returnedInstance = include $this->loaderFilePath;
111 | $this->assertInstanceOf(
112 | $className = 'Respect\Loder',
113 | $returnedInstance,
114 | sprintf('Expected an instance of "%s" to be returned from include().', $className)
115 | );
116 | }
117 |
118 | /**
119 | * @test
120 | */
121 | public function Incliding_file_with_constant_to_ignore_instantiation_should_not_return_a_Loader_instance()
122 | {
123 | $this->markTestIncomplete();
124 | }
125 | }
126 |
127 |
--------------------------------------------------------------------------------