Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit 0e6ee8d

Browse files
committed
merged branch willdurand/fix-components (PR #4155)
Commits ------- c195957 [Components] Tests/Autoloading fixes Discussion ---------- Fix components See #4141 ---- This PR: * configures each component to use composer to manage "dev" dependencies instead of env variables; * adds phpunit configuration file on Filesystem component; * fixes READMEs. It's mergeable without any problems, but I would recommend to wait a fix in Composer in order to use `self.version` in `require`/`require-dev` sections. Note: I kept `suggest` sections because it makes sense but this PR doesn't aim to provide useful explanations for each entry. It could be another PR, not that one. --------------------------------------------------------------------------- by willdurand at 2012-04-30T20:43:13Z @fabpot I reviewed each component, one by one. Now `phpunit` always works, even if tests are skipped. A simple `composer install --dev` allows to run the complete test suite. Each commit is well separated from the others. I guess, everything is ok now. --------------------------------------------------------------------------- by Tobion at 2012-04-30T20:47:00Z Please squash, as it makes no sense to have the same commit for each component. --------------------------------------------------------------------------- by fabpot at 2012-05-01T14:26:11Z Can you squash your commits before I merge? Thanks. --------------------------------------------------------------------------- by willdurand at 2012-05-01T14:29:38Z done --------------------------------------------------------------------------- by fabpot at 2012-05-01T15:48:25Z It does not seem that the commits are squashed. --------------------------------------------------------------------------- by willdurand at 2012-05-01T15:54:08Z done
2 parents 0b8b41c + fa1f0fd commit 0e6ee8d

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
composer.lock

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ Resources
6464

6565
You can run the unit tests with the following command:
6666

67-
phpunit -c src/Symfony/Component/ClassLoader/
67+
phpunit
6868

6969
If you also want to run the unit tests that depend on other Symfony
70-
Components, declare the following environment variables before running
71-
PHPUnit:
70+
Components, install dev dependencies before running PHPUnit:
7271

73-
export SYMFONY_FINDER=../path/to/Finder
72+
php composer.phar install --dev

Tests/bootstrap.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@
1010
*/
1111

1212
spl_autoload_register(function ($class) {
13-
foreach (array(
14-
'SYMFONY_FINDER' => 'Finder',
15-
) as $env => $name) {
16-
if (isset($_SERVER[$env]) && 0 === strpos(ltrim($class, '/'), 'Symfony\Component\\'.$name)) {
17-
if (file_exists($file = $_SERVER[$env].'/'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\\'.$name)).'.php')) {
18-
require_once $file;
19-
}
20-
}
21-
}
22-
2313
if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\ClassLoader')) {
2414
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\ClassLoader')).'.php')) {
2515
require_once $file;
2616
}
2717
}
2818
});
19+
20+
if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
21+
require_once $loader;
22+
}

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
"require": {
1919
"php": ">=5.3.2"
2020
},
21+
"require-dev": {
22+
"symfony/finder": "2.1.*"
23+
},
2124
"autoload": {
2225
"psr-0": { "Symfony\\Component\\ClassLoader": "" }
2326
},

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<exclude>
2424
<directory>./Resources</directory>
2525
<directory>./Tests</directory>
26+
<directory>./vendor</directory>
2627
</exclude>
2728
</whitelist>
2829
</filter>

0 commit comments

Comments
 (0)