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 69b8579 commit c6dc10ec2ca505add5d9dd17c0bfa22793b926f8 @willdurand willdurand committed Apr 27, 2012
Showing with 13 additions and 14 deletions.
  1. +2 −0 .gitignore
  2. +3 −4 README.md
  3. +4 −10 Tests/bootstrap.php
  4. +3 −0 composer.json
  5. +1 −0 phpunit.xml.dist
View
@@ -0,0 +1,2 @@
+vendor/
+composer.lock
View
@@ -27,10 +27,9 @@ Resources
You can run the unit tests with the following command:
- phpunit -c src/Symfony/Component/DomCrawler/
+ 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_CSS_SELECTOR=../path/to/CssSelector
+ php composer.phar install --dev
View
@@ -10,19 +10,13 @@
*/
spl_autoload_register(function ($class) {
- foreach (array(
- 'SYMFONY_CSS_SELECTOR' => 'CssSelector',
- ) 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\DomCrawler')) {
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\DomCrawler')).'.php')) {
require_once $file;
}
}
});
+
+if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
+ require_once $loader;
+}
View
@@ -18,6 +18,9 @@
"require": {
"php": ">=5.3.2"
},
+ "require-dev": {
+ "symfony/css-selector": "2.1.*"
+ },
"suggest": {
"symfony/css-selector": "self.version"
},
View
@@ -23,6 +23,7 @@
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
+ <directory>./vendor</directory>
</exclude>
</whitelist>
</filter>

0 comments on commit c6dc10e

Please sign in to comment.