Skip to content

Commit

Permalink
merged branch willdurand/fix-components (PR #4155)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fabpot committed May 1, 2012
2 parents a032eb1 + 673ba8e commit 0c1ae48
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
vendor/
composer.lock
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -20,11 +20,9 @@ Resources

You can run the unit tests with the following command:

phpunit -c src/Symfony/Component/EventDispatcher/
phpunit

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

export SYMFONY_DEPENDENCY_INJECTION=../path/to/DependencyInjection
export SYMFONY_HTTP_KERNEL=../path/to/HttpKernel
php composer.phar install --dev
15 changes: 4 additions & 11 deletions Tests/bootstrap.php
Expand Up @@ -10,20 +10,13 @@
*/

spl_autoload_register(function ($class) {
foreach (array(
'SYMFONY_DEPENDENCY_INJECTION' => 'DependencyInjection',
'SYMFONY_HTTP_KERNEL' => 'HttpKernel',
) as $env => $name) {
if (isset($_SERVER[$env]) && 0 === strpos(ltrim($class, '/'), 'Symfony\Component\\'.$name)) {
if (file_exists($file = $_SERVER[$env].'/'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\\'.$name)).'.php')) {
require_once $file;
}
}
}

if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\EventDispatcher')) {
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\EventDispatcher')).'.php')) {
require_once $file;
}
}
});

if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
require_once $loader;
}
3 changes: 3 additions & 0 deletions composer.json
Expand Up @@ -18,6 +18,9 @@
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"symfony/dependency-injection": "2.1.*"
},
"suggest": {
"symfony/dependency-injection": "self.version",
"symfony/http-kernel": "self.version"
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Expand Up @@ -23,6 +23,7 @@
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
Expand Down

0 comments on commit 0c1ae48

Please sign in to comment.