Permalink
Browse files

[Components] Tests/Autoloading fixes

* Switched to Composer to manage "dev" dependencies
* Fixed READMEs
* Excluded vendor in phpunit.xml.dist files
* Fixed message in bootstrap.php files
* Added autoloader for the component itself
  • Loading branch information...
1 parent cac219a commit 439ddfdf470a3556d50f60ecaad4e84d2b30c77f @willdurand willdurand committed Apr 27, 2012
Showing with 14 additions and 17 deletions.
  1. +2 −0 .gitignore
  2. +3 −5 README.md
  3. +4 −11 Tests/bootstrap.php
  4. +4 −0 composer.json
  5. +1 −1 phpunit.xml.dist
View
@@ -0,0 +1,2 @@
+vendor/
+composer.lock
View
@@ -30,11 +30,9 @@ http://symfony.com/doc/2.0/book/translation.html
You can run the unit tests with the following command:
- phpunit -c src/Symfony/Component/Translation/
+ 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
+ php composer.phar install --dev
View
@@ -10,20 +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 (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Translation')) {
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Translation')).'.php')) {
require_once $file;
}
}
});
+
+if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
+ require_once $loader;
+}
View
@@ -18,6 +18,10 @@
"require": {
"php": ">=5.3.2"
},
+ "require-dev": {
+ "symfony/config": "2.1.*",
+ "symfony/yaml": "2.1.*"
+ },
"suggest": {
"symfony/config": "self.version",
"symfony/yaml": "self.version"
View
@@ -21,7 +21,7 @@
<whitelist>
<directory>./</directory>
<exclude>
- <directory>./Resources</directory>
+ <directory>./vendor</directory>
<directory>./Tests</directory>
</exclude>
</whitelist>

0 comments on commit 439ddfd

Please sign in to comment.