Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

composified and fixed some tests

  • Loading branch information...
commit fb63bd873a17eaf0f55119372ff8f741c8cd214e 1 parent 2e23871
@bamarni bamarni authored
View
1  .gitignore
@@ -1 +1,2 @@
vendor
+composer.lock
View
2  Form/JQuery/Type/ImageType.php
@@ -47,7 +47,7 @@ public function __construct($selected, array $thumbnails, array $filters)
*/
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
{
- $configs = $form->getAttribute('configs');
+ $configs = $options['configs'];
$data = $form->getClientData();
if (!empty($data)) {
View
4 Tests/DoctrineMongoTestCase.php
@@ -41,10 +41,6 @@ protected function setUp()
*/
public static function createTestDocumentManager($paths = array())
{
- if (!class_exists('PDO') || !in_array('pgsql', \PDO::getAvailableDrivers())) {
- self::markTestSkipped('This test requires PgSQL support in your environment');
- }
-
$config = new Configuration();
$config->setAutoGenerateProxyClasses(true);
$config->setProxyDir(\sys_get_temp_dir());
View
6 Tests/DoctrineOrmTestCase.php
@@ -35,8 +35,8 @@ protected function setUp()
*/
public static function createTestEntityManager($paths = array())
{
- if (!class_exists('PDO') || !in_array('pgsql', \PDO::getAvailableDrivers())) {
- self::markTestSkipped('This test requires PgSQL support in your environment');
+ if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
+ self::markTestSkipped('This test requires SQLite support in your environment');
}
$config = new Configuration();
@@ -48,7 +48,7 @@ public static function createTestEntityManager($paths = array())
$config->setMetadataCacheImpl(new ArrayCache());
$params = array(
- 'driver' => 'pdo_pgsql',
+ 'driver' => 'pdo_sqlite',
'dbname' => 'test',
'memory' => true,
);
View
24 Tests/Form/Core/Type/CaptchaTypeTest.php
@@ -46,7 +46,7 @@ public function testConfigs()
$form = $this->factory->create('genemu_captcha', null, array(
'width' => 200,
'font_color' => array('000'),
- 'code' => '1234',
+ 'code' => '1111',
'format' => 'gif',
));
@@ -54,7 +54,7 @@ public function testConfigs()
$captcha = $form->getAttribute('captcha');
$this->assertEquals(200, $view->getVar('width'));
- $this->assertEquals(md5('1234s$cr$t'), $captcha->getCode());
+ $this->assertEquals(md5('1111s$cr$t'), $captcha->getCode());
$this->assertStringStartsWith('data:image/gif;base64,', $view->getVar('src'));
$this->assertEquals(4, $captcha->getLength());
}
@@ -85,4 +85,24 @@ public function testFaultFormat()
$this->assertStringStartsWith('data:image/jpeg;base64,', $view->getVar('src'));
}
+
+ public function testCodePasses()
+ {
+ $form = $this->factory->create('genemu_captcha');
+ $form->createView();
+
+ $form->bind('1234');
+
+ $this->assertTrue($form->isValid());
+ }
+
+ public function testCodeFails()
+ {
+ $form = $this->factory->create('genemu_captcha');
+ $form->createView();
+
+ $form->bind('4321');
+
+ $this->assertFalse($form->isValid());
+ }
}
View
69 ...rm/Type/Document/JQuery/AutocompleterTypeTest.php → ...m/Doctrine/Type/DocumentAutocompleterTypeTest.php
@@ -9,20 +9,21 @@
* file that was distributed with this source code.
*/
-namespace Genemu\Bundle\FormBundle\Tests\From\Type\Document\JQuery;
+namespace Genemu\Bundle\FormBundle\Tests\Form\Type\Document\JQuery;
use Doctrine\Common\Collections\ArrayCollection;
use Genemu\Bundle\FormBundle\Tests\Form\Type\TypeTestCase;
use Genemu\Bundle\FormBundle\Tests\Form\Extension\DoctrineMongoExtensionTest;
use Genemu\Bundle\FormBundle\Tests\DoctrineMongoTestCase;
+use Genemu\Bundle\FormBundle\Form\JQuery\Type\AutocompleterType;
use Genemu\Bundle\FormBundle\Tests\Fixtures\Document\SingleIdentDocument;
/**
* @author Olivier Chauvel <olivier@generation-multiple.com>
*/
-class AutocompleterTypeTest extends TypeTestCase
+class DocumentAutocompleterTypeTest extends TypeTestCase
{
const SINGLE_IDENT_CLASS = 'Genemu\Bundle\FormBundle\Tests\Fixtures\Document\SingleIdentDocument';
@@ -77,11 +78,10 @@ public function testDefaultValue()
$this->persist(array($document1, $document2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
- 'document_manager' => 'default',
+ $form = $this->factory->createNamed('name', new AutocompleterType('document'), null, array(
+ 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'document'
));
$form->setData(null);
@@ -90,13 +90,13 @@ public function testDefaultValue()
$this->assertEquals(array(
array('value' => 'azerty1', 'label' => 'Foo'),
array('value' => 'azerty2', 'label' => 'Bar')
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertNull($form->getData());
$this->assertEquals('', $form->getClientData());
- $this->assertNull($view->get('route_name'));
- $this->assertEquals('', $view->get('autocompleter_value'));
+ $this->assertNull($view->getVar('route_name'));
+ $this->assertEquals('', $view->getVar('autocompleter_value'));
}
public function testMultipleValue()
@@ -106,11 +106,10 @@ public function testMultipleValue()
$this->persist(array($document1, $document2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('document'), null, array(
'document_manager' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'document',
'multiple' => true
));
$form->setData(null);
@@ -120,13 +119,13 @@ public function testMultipleValue()
$this->assertEquals(array(
array('value' => 1, 'label' => 'Foo'),
array('value' => 2, 'label' => 'Bar')
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertNull($form->getData());
$this->assertEquals('', $form->getClientData());
- $this->assertNull($view->get('route_name'));
- $this->assertEquals('', $view->get('autocompleter_value'));
+ $this->assertNull($view->getVar('route_name'));
+ $this->assertEquals('', $view->getVar('autocompleter_value'));
}
public function testValueData()
@@ -136,11 +135,10 @@ public function testValueData()
$this->persist(array($document1, $document2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('document'), null, array(
'document_manager' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'document',
));
$form->setData($document1);
$view = $form->createView();
@@ -152,16 +150,16 @@ public function testValueData()
$this->assertEquals(array(
array('value' => 'azerty1', 'label' => 'Foo'),
array('value' => 2, 'label' => 'Bar'),
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
- 'value' => 2,
+ 'value' => '2',
'label' => 'Bar'
)), $form->getClientData());
$this->assertSame($document2, $form->getData());
- $this->assertNull($view->get('route_name'));
- $this->assertEquals('Foo', $view->get('autocompleter_value'));
+ $this->assertNull($view->getVar('route_name'));
+ $this->assertEquals('Foo', $view->getVar('autocompleter_value'));
}
public function testValueMultipleData()
@@ -171,11 +169,10 @@ public function testValueMultipleData()
$this->persist(array($document1, $document2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('document'), null, array(
'document_manager' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'document',
'multiple' => true
));
$existing = new ArrayCollection(array($document1));
@@ -191,15 +188,15 @@ public function testValueMultipleData()
$this->assertEquals(array(
array('value' => 1, 'label' => 'Foo'),
array('value' => 2, 'label' => 'Bar'),
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
- array('value' => 1, 'label' => 'Foo'),
- array('value' => 2, 'label' => 'Bar'),
+ array('value' => '1', 'label' => 'Foo'),
+ array('value' => '2', 'label' => 'Bar'),
)), $form->getClientData());
$this->assertSame($existing, $form->getData());
- $this->assertEquals('Foo, ', $view->get('autocompleter_value'));
+ $this->assertEquals('Foo, ', $view->getVar('autocompleter_value'));
}
public function testValueAjaxData()
@@ -209,11 +206,10 @@ public function testValueAjaxData()
$this->persist(array($document1, $document2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('document'), null, array(
'document_manager' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'document',
'route_name' => 'genemu_ajax'
));
@@ -222,16 +218,16 @@ public function testValueAjaxData()
$form->bind(json_encode(array('value' => 2, 'label' => 'Bar')));
- $this->assertEquals('genemu_ajax', $view->get('route_name'));
+ $this->assertEquals('genemu_ajax', $view->getVar('route_name'));
- $this->assertEquals(array(), $form->getAttribute('choice_list')->getChoices());
+ $this->assertEquals(array(), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
- 'value' => 2,
+ 'value' => '2',
'label' => 'Bar',
)), $form->getClientData());
$this->assertSame($document2, $form->getData());
- $this->assertEquals('Foo', $view->get('autocompleter_value'));
+ $this->assertEquals('Foo', $view->getVar('autocompleter_value'));
}
public function testValueAjaxMultipleData()
@@ -241,11 +237,10 @@ public function testValueAjaxMultipleData()
$this->persist(array($document1, $document2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('document'), null, array(
'document_manager' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'document',
'route_name' => 'genemu_ajax',
'multiple' => true,
));
@@ -258,16 +253,16 @@ public function testValueAjaxMultipleData()
array('value' => 2, 'label' => 'Bar')
)));
- $this->assertEquals('genemu_ajax', $view->get('route_name'));
+ $this->assertEquals('genemu_ajax', $view->getVar('route_name'));
- $this->assertEquals(array(), $form->getAttribute('choice_list')->getChoices());
+ $this->assertEquals(array(), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
- array('value' => 2, 'label' => 'Bar')
+ array('value' => '2', 'label' => 'Bar')
)), $form->getClientData());
$this->assertSame($existing, $form->getData());
- $this->assertEquals('Foo, Bar, ', $view->get('autocompleter_value'));
+ $this->assertEquals('Foo, Bar, ', $view->getVar('autocompleter_value'));
}
protected function createRegistryMock($name, $dm)
View
66 ...Form/Type/Entity/JQuery/AutocompleterTypeTest.php → ...orm/Doctrine/Type/EntityAutocompleterTypeTest.php
@@ -9,11 +9,12 @@
* file that was distributed with this source code.
*/
-namespace Genemu\Bundle\FormBundle\Tests\From\Type\Entity\JQuery;
+namespace Genemu\Bundle\FormBundle\Tests\Form\Type\Entity\JQuery;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\Common\Collections\ArrayCollection;
+use Genemu\Bundle\FormBundle\Form\JQuery\Type\AutocompleterType;
use Genemu\Bundle\FormBundle\Tests\Form\Type\TypeTestCase;
use Genemu\Bundle\FormBundle\Tests\Form\Extension\DoctrineOrmExtensionTest;
use Genemu\Bundle\FormBundle\Tests\DoctrineOrmTestCase;
@@ -23,7 +24,7 @@
/**
* @author Olivier Chauvel <olivier@generation-multiple.com>
*/
-class AutocompleterTypeTest extends TypeTestCase
+class EntityAutocompleterTypeTest extends TypeTestCase
{
const SINGLE_IDENT_CLASS = 'Genemu\Bundle\FormBundle\Tests\Fixtures\Entity\SingleIdentEntity';
@@ -87,11 +88,10 @@ public function testDefaultValue()
$this->persist(array($entity1, $entity2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('entity'), null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'entity'
));
$form->setData(null);
@@ -100,13 +100,13 @@ public function testDefaultValue()
$this->assertEquals(array(
array('value' => 1, 'label' => 'Foo'),
array('value' => 2, 'label' => 'Bar'),
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertNull($form->getData());
$this->assertEquals('', $form->getClientData());
- $this->assertNull($view->get('route_name'));
- $this->assertEquals('', $view->get('autocompleter_value'));
+ $this->assertNull($view->getVar('route_name'));
+ $this->assertEquals('', $view->getVar('autocompleter_value'));
}
public function testMultipleValue()
@@ -116,11 +116,11 @@ public function testMultipleValue()
$this->persist(array($entity1, $entity2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('entity'), null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'entity',
+
'multiple' => true
));
$form->setData(null);
@@ -130,13 +130,13 @@ public function testMultipleValue()
$this->assertEquals(array(
array('value' => 1, 'label' => 'Foo'),
array('value' => 2, 'label' => 'Bar'),
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertNull($form->getData());
$this->assertEquals('', $form->getClientData());
- $this->assertNull($view->get('route_name'));
- $this->assertEquals('', $view->get('autocompleter_value'));
+ $this->assertNull($view->getVar('route_name'));
+ $this->assertEquals('', $view->getVar('autocompleter_value'));
}
public function testValueData()
@@ -146,11 +146,11 @@ public function testValueData()
$this->persist(array($entity1, $entity2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('entity'), null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'entity',
+
));
$form->setData($entity1);
$view = $form->createView();
@@ -162,16 +162,16 @@ public function testValueData()
$this->assertEquals(array(
array('value' => 1, 'label' => 'Foo'),
array('value' => 2, 'label' => 'Bar'),
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
- 'value' => 2,
+ 'value' => '2',
'label' => 'Bar'
)), $form->getClientData());
$this->assertSame($entity2, $form->getData());
- $this->assertNull($view->get('route_name'));
- $this->assertEquals('Foo', $view->get('autocompleter_value'));
+ $this->assertNull($view->getVar('route_name'));
+ $this->assertEquals('Foo', $view->getVar('autocompleter_value'));
}
public function testValueMultipleData()
@@ -181,11 +181,11 @@ public function testValueMultipleData()
$this->persist(array($entity1, $entity2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('entity'), null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'entity',
+
'multiple' => true
));
$existing = new ArrayCollection(array($entity1));
@@ -201,15 +201,15 @@ public function testValueMultipleData()
$this->assertEquals(array(
array('value' => 1, 'label' => 'Foo'),
array('value' => 2, 'label' => 'Bar'),
- ), $form->getAttribute('choice_list')->getChoices());
+ ), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
- array('value' => 1, 'label' => 'Foo'),
- array('value' => 2, 'label' => 'Bar'),
+ array('value' => '1', 'label' => 'Foo'),
+ array('value' => '2', 'label' => 'Bar'),
)), $form->getClientData());
$this->assertSame($existing, $form->getData());
- $this->assertEquals('Foo, ', $view->get('autocompleter_value'));
+ $this->assertEquals('Foo, ', $view->getVar('autocompleter_value'));
}
public function testValueAjaxData()
@@ -219,11 +219,10 @@ public function testValueAjaxData()
$this->persist(array($entity1, $entity2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('entity'), null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'entity',
'route_name' => 'genemu_ajax'
));
@@ -232,16 +231,16 @@ public function testValueAjaxData()
$form->bind(json_encode(array('value' => 2, 'label' => 'Bar')));
- $this->assertEquals('genemu_ajax', $view->get('route_name'));
+ $this->assertEquals('genemu_ajax', $view->getVar('route_name'));
- $this->assertEquals(array(), $form->getAttribute('choice_list')->getChoices());
+ $this->assertEquals(array(), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
'value' => 2,
'label' => 'Bar',
)), $form->getClientData());
$this->assertSame($entity2, $form->getData());
- $this->assertEquals('Foo', $view->get('autocompleter_value'));
+ $this->assertEquals('Foo', $view->getVar('autocompleter_value'));
}
public function testValueAjaxMultipleData()
@@ -251,11 +250,10 @@ public function testValueAjaxMultipleData()
$this->persist(array($entity1, $entity2));
- $form = $this->factory->createNamed('genemu_jqueryautocompleter', 'name', null, array(
+ $form = $this->factory->createNamed('name', new AutocompleterType('entity'), null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'property' => 'name',
- 'widget' => 'entity',
'route_name' => 'genemu_ajax',
'multiple' => true,
));
@@ -268,16 +266,16 @@ public function testValueAjaxMultipleData()
array('value' => 2, 'label' => 'Bar')
)));
- $this->assertEquals('genemu_ajax', $view->get('route_name'));
+ $this->assertEquals('genemu_ajax', $view->getVar('route_name'));
- $this->assertEquals(array(), $form->getAttribute('choice_list')->getChoices());
+ $this->assertEquals(array(), $view->getVar('choices'));
$this->assertEquals(json_encode(array(
array('value' => 2, 'label' => 'Bar')
)), $form->getClientData());
$this->assertSame($existing, $form->getData());
- $this->assertEquals('Foo, Bar, ', $view->get('autocompleter_value'));
+ $this->assertEquals('Foo, Bar, ', $view->getVar('autocompleter_value'));
}
protected function createRegistryMock($name, $em)
View
4 Tests/Form/Extension/DoctrineMongoExtensionTest.php
@@ -11,9 +11,9 @@
namespace Genemu\Bundle\FormBundle\Tests\Form\Extension;
-use Symfony\Bundle\DoctrineMongoDBBundle\Form\DoctrineMongoDBExtension;
+use Doctrine\Bundle\MongoDBBundle\Form\DoctrineMongoDBExtension;
-use Genemu\Bundle\FormBundle\Form\Document\Type;
+use Genemu\Bundle\FormBundle\Form\Doctrine\Type;
/**
* @author Olivier Chauvel <olivier@generation-multiple.com>
View
2  Tests/Form/Extension/TypeExtensionTest.php
@@ -66,7 +66,7 @@ protected function loadTypes()
),
'background_color' => 'DDDDDD',
'border_color' => '000000',
- 'code' => '0000',
+ 'code' => '1234',
)),
new Form\JQuery\Type\FileType(array(
'script' => 'genemu_upload',
View
18 Tests/Form/Type/JQuery/ImageTypeTest.php → Tests/Form/JQuery/Type/ImageTypeTest.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Genemu\Bundle\FormBundle\Tests\Form\Type;
+namespace Genemu\Bundle\FormBundle\Tests\Form\JQuery\Type;
use Symfony\Component\HttpFoundation\File\File;
@@ -38,10 +38,10 @@ public function testDefaultConfigs()
$form = $this->factory->create('genemu_jqueryimage');
$view = $form->createView();
- $configs = $view->get('configs');
+ $configs = $view->getVar('configs');
- $this->assertEquals('', $view->get('value'));
- $this->assertFalse($view->get('required'));
+ $this->assertEquals('', $view->getVar('value'));
+ $this->assertFalse($view->getVar('required'));
$this->assertEquals(realpath(__DIR__.'/../../../Fixtures'), realpath($form->getAttribute('rootDir')));
$this->assertEquals('/upload', $configs['folder']);
@@ -61,9 +61,9 @@ public function testConfigs()
$view = $form->createView();
- $configs = $view->get('configs');
+ $configs = $view->getVar('configs');
- $this->assertFalse($view->get('required'));
+ $this->assertFalse($view->getVar('required'));
$this->assertEquals('/images', $configs['folder']);
$this->assertEquals('/swf/uploadify.swf', $configs['uploader']);
$this->assertEquals('/js/uploadify/cancel.png', $configs['cancel_img']);
@@ -78,7 +78,7 @@ public function testValue()
$view = $form->createView();
$this->assertEquals('/upload/symfony.png', $form->getClientData());
- $this->assertEquals('/upload/symfony.png', $view->get('value'));
+ $this->assertEquals('/upload/symfony.png', $view->getVar('value'));
}
public function testImageValue()
@@ -88,11 +88,11 @@ public function testImageValue()
$form->setData(new Image(__DIR__ . '/../../../Fixtures/upload/symfony.png'));
$view = $form->createView();
- $data = $form->getClientData();
+ $data = $form->getNormData();
$this->assertInstanceOf(self::IMAGE_CLASS, $data);
$this->assertEquals(160, $data->getWidth());
$this->assertEquals(134, $data->getHeight());
- $this->assertEquals('/upload/symfony.png', $view->get('value'));
+ $this->assertEquals('/upload/symfony.png', $view->getVar('value'));
}
}
View
67 Tests/autoload.php.dist
@@ -1,67 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Olivier Chauvel <olivier@generation-multiple.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-$vendorDir = __DIR__.'/../vendor';
-require_once $vendorDir.'/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
-
-use Symfony\Component\ClassLoader\UniversalClassLoader;
-use Doctrine\Common\Annotations\AnnotationRegistry;
-
-$loader = new UniversalClassLoader();
-$loader->registerNamespaces(array(
- 'Symfony' => array(
- $vendorDir.'/symfony/src',
- $vendorDir.'/symfony/tests',
- $vendorDir.'/bundles'
- ),
- 'Propel' => array($vendorDir.'/propel'),
- 'Doctrine' => array($vendorDir.'/doctrine/lib'),
- 'Doctrine\\Common' => array($vendorDir.'/doctrine-common/lib'),
- 'Doctrine\\DBAL' => array($vendorDir.'/doctrine-dbal/lib'),
- 'Doctrine\\ODM\\MongoDB' => array($vendorDir.'/doctrine-mongodb-odm/lib'),
- 'Doctrine\\MongoDB' => array($vendorDir.'/doctrine-mongodb/lib'),
-));
-$loader->registerPrefixes(array(
- 'Twig_' => $vendorDir.'/twig/lib',
-));
-
-// intl
-if (!function_exists('intl_get_error_code')) {
- require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
-
- $loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
-}
-
-$loader->register();
-
-AnnotationRegistry::registerLoader(function($class) use ($loader) {
- $loader->loadClass($class);
- return class_exists($class, false);
-});
-AnnotationRegistry::registerFile(
- $vendorDir.'/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
-);
-AnnotationRegistry::registerFile(
- $vendorDir.'/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php'
-);
-
-spl_autoload_register(function($class) {
- if (0 === strpos($class, 'Genemu\\Bundle\\FormBundle\\')) {
- $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 3)).'.php';
-
- if (!stream_resolve_include_path($path)) {
- return false;
- }
- require_once $path;
-
- return true;
- }
-});
View
13 Tests/bootstrap.php
@@ -9,8 +9,13 @@
* file that was distributed with this source code.
*/
-if (file_exists($file = __DIR__.'/autoload.php')) {
- require_once $file;
-} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) {
- require_once $file;
+if (!@$loader = include __DIR__.'/../vendor/autoload.php') {
+ throw new RuntimeException('Install dependencies to run test suite.');
}
+
+use Doctrine\Common\Annotations\AnnotationRegistry;
+use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
+
+AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
+
+AnnotationDriver::registerAnnotationClasses();
View
9 composer.json
@@ -20,11 +20,16 @@
"symfony/framework-bundle": "2.*",
"symfony/form": "2.*"
},
+ "require-dev": {
+ "symfony/finder": "2.*",
+ "doctrine/orm": "*",
+ "doctrine/doctrine-bundle": "*",
+ "doctrine/mongodb-odm-bundle": "*",
+ "propel/propel-bundle": "*"
+ },
"suggest": {
"symfony/twig-bridge": "2.*",
- "symfony/doctrine-bridge": "2.*",
"symfony/doctrine-bundle": "2.*",
- "symfony/http-kernel": "2.*",
"symfony/finder": "2.*",
"symfony/mongodb-odm-bundle": "2.*",
"propel/propel-bundle": "2.*"
View
40 vendor/vendors.php
@@ -1,40 +0,0 @@
-#!/usr/bin/env php
-
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Olivier Chauvel <olivier@generation-multiple.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-set_time_limit(0);
-
-$vendorDir = __DIR__;
-
-$deps = array(
- array('symfony', 'git://github.com/symfony/symfony.git', 'origin/master'),
- array('propel', 'git://github.com/propelorm/PropelBundle.git', 'origin/master'),
- array('doctrine', 'git://github.com/doctrine/doctrine2.git', 'origin/master'),
- array('doctrine-common', 'git://github.com/doctrine/common.git', 'origin/master'),
- array('doctrine-dbal', 'git://github.com/doctrine/dbal.git', 'origin/master'),
- array('doctrine-mongodb', 'git://github.com/doctrine/mongodb.git', 'origin/master'),
- array('doctrine-mongodb-odm', 'git://github.com/doctrine/mongodb-odm.git', 'origin/master'),
- array('bundles/Symfony/Bundle/DoctrineMongoDBBundle', 'git://github.com/symfony/DoctrineMongoDBBundle.git', 'origin/master'),
-);
-
-foreach ($deps as $dep) {
- list($name, $url, $rev) = $dep;
-
- echo "> Installing/Updating $name\n";
-
- $installDir = $vendorDir.'/'.$name;
- if (!is_dir($installDir)) {
- system(sprintf('git clone -q %s %s', escapeshellarg($url), escapeshellarg($installDir)));
- }
-
- system(sprintf('cd %s && git fetch -q origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
-}
Please sign in to comment.
Something went wrong with that request. Please try again.