summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2012-05-01 17:59:34 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2012-05-01 17:59:34 +0200
commit95a080053f8dce4f883ad91225e1bef9259fd6ac (patch)
tree51401b56d549627c744deef9f8a466142aeb46ac
parent9ed448495929292bda245fdd74753c98a35d0577 (diff)
parentffef59ac47cfb80696c545b01eeb92b12c043420 (diff)
downloadsymfony-security-95a080053f8dce4f883ad91225e1bef9259fd6ac.zip
symfony-security-95a080053f8dce4f883ad91225e1bef9259fd6ac.tar.gz
symfony-security-95a080053f8dce4f883ad91225e1bef9259fd6ac.tar.bz2
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
-rw-r--r--.gitignore2
-rw-r--r--README.md15
-rw-r--r--Tests/bootstrap.php30
-rw-r--r--composer.json12
-rw-r--r--phpunit.xml.dist2
5 files changed, 20 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d1502b0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+vendor/
+composer.lock
diff --git a/README.md b/README.md
index ca3b710..7ae97b1 100644
--- a/README.md
+++ b/README.md
@@ -18,16 +18,9 @@ Resources
You can run the unit tests with the following command:
- phpunit -c src/Symfony/Component/Security/
+ phpunit
If you also want to run the unit tests that depend on other Symfony
-Components, declare the following environment variables before running
-PHPUnit:
-
- export SYMFONY_HTTP_FOUNDATION=../path/to/HttpFoundation
- export SYMFONY_HTTP_KERNEL=../path/to/HttpKernel
- export SYMFONY_EVENT_DISPATCHER=../path/to/EventDispatcher
- export SYMFONY_FORM=../path/to/Form
- export SYMFONY_ROUTING=../path/to/Routing
- export DOCTRINE_DBAL=../path/to/doctrine-dbal
- export DOCTRINE_COMMON=../path/to/doctrine-common
+Components, install dev dependencies before running PHPUnit:
+
+ php composer.phar install --dev
diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php
index b154988..84ae3a6 100644
--- a/Tests/bootstrap.php
+++ b/Tests/bootstrap.php
@@ -10,35 +10,13 @@
*/
spl_autoload_register(function ($class) {
- foreach (array(
- 'SYMFONY_HTTP_FOUNDATION' => 'HttpFoundation',
- 'SYMFONY_HTTP_KERNEL' => 'HttpKernel',
- 'SYMFONY_EVENT_DISPATCHER' => 'EventDispatcher',
- 'SYMFONY_FORM' => 'Form',
- 'SYMFONY_ROUTING' => 'Routing',
- ) 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_DBAL']) && 0 === strpos(ltrim($class, '/'), 'Doctrine\DBAL')) {
- if (file_exists($file = $_SERVER['DOCTRINE_DBAL'].'/lib/'.str_replace('\\', '/', $class).'.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\Security')) {
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Security')).'.php')) {
require_once $file;
}
}
});
+
+if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
+ require_once $loader;
+}
diff --git a/composer.json b/composer.json
index 0dbade1..8619b57 100644
--- a/composer.json
+++ b/composer.json
@@ -17,9 +17,15 @@
],
"require": {
"php": ">=5.3.2",
- "symfony/event-dispatcher": "self.version",
- "symfony/http-foundation": "self.version",
- "symfony/http-kernel": "self.version"
+ "symfony/event-dispatcher": "2.1.*",
+ "symfony/http-foundation": "2.1.*",
+ "symfony/http-kernel": "2.1.*"
+ },
+ "require-dev": {
+ "symfony/form": "2.1.*",
+ "symfony/routing": "2.1.*",
+ "doctrine/common": ">=2.1,<2.3-dev",
+ "doctrine/dbal": ">=2.1,<2.3-dev"
},
"suggest": {
"symfony/class-loader": "self.version",
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 7c9b67d..0560cf5 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -21,7 +21,7 @@
<whitelist>
<directory>./</directory>
<exclude>
- <directory>./Resources</directory>
+ <directory>./vendor</directory>
<directory>./Tests</directory>
</exclude>
</whitelist>