Skip to content
Browse files

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
  • Loading branch information...
2 parents 391d40b + 357fbb0 commit b6c2bafae0cf8a557d719598a4a462676c3d04bd @fabpot fabpot committed May 1, 2012
Showing with 17 additions and 25 deletions.
  1. +2 −0 .gitignore
  2. +3 −6 README.md
  3. +4 −17 Tests/bootstrap.php
  4. +7 −1 composer.json
  5. +1 −1 phpunit.xml.dist
View
2 .gitignore
@@ -0,0 +1,2 @@
+vendor/
+composer.lock
View
9 README.md
@@ -29,12 +29,9 @@ Resources
You can run the unit tests with the following command:
- phpunit -c src/Symfony/Component/Routing/
+ 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_CONFIG=../path/to/Config
- export SYMFONY_YAML=../path/to/Yaml
- export DOCTRINE_COMMON=../path/to/doctrine-common
+ php composer.phar install --dev
View
21 Tests/bootstrap.php
@@ -10,26 +10,13 @@
*/
spl_autoload_register(function ($class) {
- foreach (array(
- 'SYMFONY_CONFIG' => 'Config',
- 'SYMFONY_YAML' => 'Yaml',
- ) 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 (isset($_SERVER['DOCTRINE_COMMON']) && 0 === strpos(ltrim($class, '/'), 'Doctrine\Common')) {
- if (file_exists($file = $_SERVER['DOCTRINE_COMMON'].'/lib/'.str_replace('\\', '/', $class).'.php')) {
- require_once $file;
- }
- }
-
if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Routing')) {
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Routing')).'.php')) {
require_once $file;
}
}
});
+
+if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
+ require_once $loader;
+}
View
8 composer.json
@@ -18,9 +18,15 @@
"require": {
"php": ">=5.3.2"
},
+ "require-dev": {
+ "symfony/config": "2.1.*",
+ "symfony/yaml": "2.1.*",
+ "doctrine/common": ">=2.1,<2.3-dev"
+ },
"suggest": {
"symfony/config": "self.version",
- "symfony/yaml": "self.version"
+ "symfony/yaml": "self.version",
+ "doctrine/common": ">=2.1,<2.3-dev"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Routing": "" }
View
2 phpunit.xml.dist
@@ -21,7 +21,7 @@
<whitelist>
<directory>./</directory>
<exclude>
- <directory>./Resources</directory>
+ <directory>./vendor</directory>
<directory>./Tests</directory>
</exclude>
</whitelist>

0 comments on commit b6c2baf

Please sign in to comment.
Something went wrong with that request. Please try again.