[TwigBridge] Switched to composer

This commit is contained in:
William DURAND 2012-05-12 18:52:27 +02:00
parent df36afb123
commit a1e3a597b0
6 changed files with 20 additions and 42 deletions

2
src/Symfony/Bridge/Twig/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
vendor/
composer.lock

View File

@ -7,17 +7,9 @@ Symfony2 components.
Resources Resources
--------- ---------
You can run the unit tests with the following command: If you want to run the unit tests, install dev dependencies before
running PHPUnit:
phpunit -c src/Symfony/Bridge/Twig/ php composer.phar install --dev
If you also want to run the unit tests that depend on other Symfony phpunit
Components, declare the following environment variables before running
PHPUnit:
export TWIG=../path/to/Twig
export SYMFONY_EVENT_DISPATCHER=../path/to/EventDispatcher
export SYMFONY_FORM=../path/to/Form
export SYMFONY_LOCALE=../path/to/Locale
export SYMFONY_TEMPLATING=../path/to/Templating
export SYMFONY_TRANSLATION=../path/to/Translation

View File

@ -11,12 +11,12 @@
namespace Symfony\Bridge\Twig\Tests\Extension; namespace Symfony\Bridge\Twig\Tests\Extension;
use Symfony\Component\Form\FormView;
use Symfony\Bridge\Twig\Extension\FormExtension; use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Component\Form\Tests\AbstractDivLayoutTest;
use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator;
use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Tests\AbstractDivLayoutTest;
class FormExtensionDivLayoutTest extends AbstractDivLayoutTest class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
{ {

View File

@ -9,30 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
spl_autoload_register(function ($class) { if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
foreach (array( require_once $loader;
'SYMFONY_EVENT_DISPATCHER' => 'EventDispatcher', }
'SYMFONY_FORM' => 'Form',
'SYMFONY_LOCALE' => 'Locale',
'SYMFONY_TEMPLATING' => 'Templating',
'SYMFONY_TRANSLATION' => 'Translation',
) 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['TWIG']) && 0 === strpos(ltrim($class, '/'), 'Twig_')) {
if (file_exists($file = $_SERVER['TWIG'].'/lib/'.str_replace('_', '/', $class).'.php')) {
require_once $file;
}
}
if (0 === strpos(ltrim($class, '/'), 'Symfony\Bridge\Twig')) {
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Bridge\Twig')).'.php')) {
require_once $file;
}
}
});

View File

@ -19,6 +19,13 @@
"php": ">=5.3.3", "php": ">=5.3.3",
"twig/twig": ">=1.8,<2.0-dev" "twig/twig": ">=1.8,<2.0-dev"
}, },
"require-dev": {
"symfony/form": "2.1.*",
"symfony/routing": "2.1.*",
"symfony/templating": "2.1.*",
"symfony/translation": "2.1.*",
"symfony/yaml": "2.1.*"
},
"suggest": { "suggest": {
"symfony/form": "self.version", "symfony/form": "self.version",
"symfony/routing": "self.version", "symfony/routing": "self.version",

View File

@ -9,7 +9,7 @@
processIsolation="false" processIsolation="false"
stopOnFailure="false" stopOnFailure="false"
syntaxCheck="false" syntaxCheck="false"
bootstrap="tests/bootstrap.php" bootstrap="Tests/bootstrap.php"
> >
<testsuites> <testsuites>
<testsuite name="Symfony Twig Bridge Test Suite"> <testsuite name="Symfony Twig Bridge Test Suite">
@ -23,6 +23,7 @@
<exclude> <exclude>
<directory>./Resources</directory> <directory>./Resources</directory>
<directory>./Tests</directory> <directory>./Tests</directory>
<directory>./vendor</directory>
</exclude> </exclude>
</whitelist> </whitelist>
</filter> </filter>