当前位置: 首页>>代码示例>>PHP>>正文


PHP DoctrineTestHelper::createTestEntityManager方法代码示例

本文整理汇总了PHP中Symfony\Bridge\Doctrine\Test\DoctrineTestHelper::createTestEntityManager方法的典型用法代码示例。如果您正苦于以下问题:PHP DoctrineTestHelper::createTestEntityManager方法的具体用法?PHP DoctrineTestHelper::createTestEntityManager怎么用?PHP DoctrineTestHelper::createTestEntityManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Bridge\Doctrine\Test\DoctrineTestHelper的用法示例。


在下文中一共展示了DoctrineTestHelper::createTestEntityManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!class_exists('Symfony\\Component\\Form\\Form')) {
         $this->markTestSkipped('The "Form" component is not available');
     }
     if (!class_exists('Doctrine\\DBAL\\Platforms\\MySqlPlatform')) {
         $this->markTestSkipped('Doctrine DBAL is not available.');
     }
     if (!class_exists('Doctrine\\Common\\Version')) {
         $this->markTestSkipped('Doctrine Common is not available.');
     }
     if (!class_exists('Doctrine\\ORM\\EntityManager')) {
         $this->markTestSkipped('Doctrine ORM is not available.');
     }
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $this->emRegistry = $this->createRegistryMock('default', $this->em);
     $this->items = array();
     $schemaTool = new SchemaTool($this->em);
     $classes = array($this->em->getClassMetadata(self::SINGLE_INT_ID_CLASS));
     try {
         $schemaTool->dropSchema($classes);
     } catch (\Exception $e) {
     }
     try {
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     $this->createEntities();
     $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new ChoiceSelect2TypeExtension($this->dispatcher, $this->requestStack, $this->router, $this->getExtensionTypeName(), 10))->addType(new EntityType($this->emRegistry))->addTypeExtension(new EntitySelect2TypeExtension())->getFormFactory();
     $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
 }
开发者ID:mcdir,项目名称:SonatraFormExtensionsBundle,代码行数:32,代码来源:EntitySelect2TypeExtensionTest.php

示例2: setUp

 protected function setUp()
 {
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $this->registry = $this->createRegistryMock($this->em);
     $this->createSchema($this->em);
     parent::setUp();
 }
开发者ID:makhloufi-lounis,项目名称:tuto_symfony,代码行数:7,代码来源:UniqueEntityValidatorTest.php

示例3: setUp

 protected function setUp()
 {
     if (!class_exists('Symfony\\Component\\Form\\Form')) {
         $this->markTestSkipped('The "Form" component is not available');
     }
     if (!class_exists('Doctrine\\DBAL\\Platforms\\MySqlPlatform')) {
         $this->markTestSkipped('Doctrine DBAL is not available.');
     }
     if (!class_exists('Doctrine\\Common\\Version')) {
         $this->markTestSkipped('Doctrine Common is not available.');
     }
     if (!class_exists('Doctrine\\ORM\\EntityManager')) {
         $this->markTestSkipped('Doctrine ORM is not available.');
     }
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $this->emRegistry = $this->createRegistryMock('default', $this->em);
     parent::setUp();
     $schemaTool = new SchemaTool($this->em);
     $classes = array($this->em->getClassMetadata(self::ITEM_GROUP_CLASS), $this->em->getClassMetadata(self::SINGLE_IDENT_CLASS), $this->em->getClassMetadata(self::SINGLE_STRING_IDENT_CLASS), $this->em->getClassMetadata(self::COMPOSITE_IDENT_CLASS), $this->em->getClassMetadata(self::COMPOSITE_STRING_IDENT_CLASS));
     try {
         $schemaTool->dropSchema($classes);
     } catch (\Exception $e) {
     }
     try {
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
 }
开发者ID:senthil-r-wiredelta,项目名称:meilleure-visite,代码行数:28,代码来源:EntityTypeTest.php

示例4: setUp

 /**
  * Test setup
  */
 protected function setUp()
 {
     // setup entity aliases
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $entityManagerNamespaces = $this->em->getConfiguration()->getEntityNamespaces();
     $entityManagerNamespaces['WebtownPhpBannerBundle'] = 'WebtownPhp\\BannerBundle\\Entity';
     $this->em->getConfiguration()->setEntityNamespaces($entityManagerNamespaces);
     // setup schema
     $schemaTool = new SchemaTool($this->em);
     $classes = [];
     foreach ($this->getEntities() as $entityClass) {
         $classes[] = $this->em->getClassMetadata($entityClass);
     }
     try {
         $schemaTool->dropSchema($classes);
     } catch (\Exception $e) {
     }
     try {
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     $registry = \Mockery::mock('Doctrine\\Bundle\\DoctrineBundle\\Registry');
     $registry->shouldReceive('getManager')->andReturn($this->em);
     $this->bm = new ORMManager($registry, new EventDispatcher());
 }
开发者ID:webtown-php,项目名称:BannerBundle,代码行数:28,代码来源:OMTestCase.php

示例5: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     self::bootKernel();
     $this->entityClass = 'Fidry\\LoopBackApiBundle\\Tests\\Functional\\Bundle\\TestBundle\\Entity\\Dummy';
     $this->managerRegistry = self::$kernel->getContainer()->get('doctrine');
     $this->repository = DoctrineTestHelper::createTestEntityManager()->getRepository($this->entityClass);
     $this->resource = new Resource($this->entityClass);
 }
开发者ID:aitboudad,项目名称:LoopBackApiBundle,代码行数:11,代码来源:OrderFilterTest.php

示例6: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     self::bootKernel();
     $manager = DoctrineTestHelper::createTestEntityManager();
     $this->managerRegistry = self::$kernel->getContainer()->get('doctrine');
     $this->repository = $manager->getRepository(Dummy::class);
     $this->resourceClass = Dummy::class;
 }
开发者ID:api-platform,项目名称:core,代码行数:11,代码来源:NumericFilterTest.php

示例7: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     self::bootKernel();
     $class = 'Dunglas\\ApiBundle\\Tests\\Behat\\TestBundle\\Entity\\Dummy';
     $manager = DoctrineTestHelper::createTestEntityManager();
     $this->managerRegistry = self::$kernel->getContainer()->get('doctrine');
     $this->repository = $manager->getRepository($class);
     $this->resource = new Resource($class);
 }
开发者ID:rolebi,项目名称:DunglasApiBundle,代码行数:12,代码来源:OrderFilterTest.php

示例8: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     self::bootKernel();
     $manager = DoctrineTestHelper::createTestEntityManager();
     $this->managerRegistry = self::$kernel->getContainer()->get('doctrine');
     $this->iriConverter = self::$kernel->getContainer()->get('api_platform.iri_converter');
     $this->propertyAccessor = self::$kernel->getContainer()->get('property_accessor');
     $this->repository = $manager->getRepository(Dummy::class);
     $this->resourceClass = Dummy::class;
 }
开发者ID:api-platform,项目名称:core,代码行数:13,代码来源:SearchFilterTest.php

示例9: setUp

 protected function setUp()
 {
     $this->repositoryFactory = new TestRepositoryFactory();
     $config = DoctrineTestHelper::createTestConfiguration();
     $config->setRepositoryFactory($this->repositoryFactory);
     $this->em = DoctrineTestHelper::createTestEntityManager($config);
     $this->registry = $this->createRegistryMock($this->em);
     $this->createSchema($this->em);
     parent::setUp();
 }
开发者ID:symfony,项目名称:symfony,代码行数:10,代码来源:UniqueEntityValidatorTest.php

示例10: testFilterNonIntegerValues

 public function testFilterNonIntegerValues()
 {
     $em = DoctrineTestHelper::createTestEntityManager();
     $query = $this->getMockBuilder('QueryMock')->setMethods(array('setParameter', 'getResult', 'getSql', '_doExecute'))->getMock();
     $query->expects($this->once())->method('setParameter')->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3), Connection::PARAM_INT_ARRAY)->willReturn($query);
     $qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->setConstructorArgs(array($em))->setMethods(array('getQuery'))->getMock();
     $qb->expects($this->once())->method('getQuery')->willReturn($query);
     $qb->select('e')->from('Symfony\\Bridge\\Doctrine\\Tests\\Fixtures\\SingleIntIdEntity', 'e');
     $loader = new ORMQueryBuilderLoader($qb);
     $loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo'));
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:11,代码来源:ORMQueryBuilderLoaderTest.php

示例11: testSupportProxy

 public function testSupportProxy()
 {
     $em = DoctrineTestHelper::createTestEntityManager();
     $this->createSchema($em);
     $user1 = new User(1, 1, 'user1');
     $em->persist($user1);
     $em->flush();
     $em->clear();
     $provider = new EntityUserProvider($this->getManager($em), 'Symfony\\Bridge\\Doctrine\\Tests\\Fixtures\\User', 'name');
     $user2 = $em->getReference('Symfony\\Bridge\\Doctrine\\Tests\\Fixtures\\User', array('id1' => 1, 'id2' => 1));
     $this->assertTrue($provider->supportsClass(get_class($user2)));
 }
开发者ID:Milkyway2605,项目名称:EasyStage_Symfony,代码行数:12,代码来源:EntityUserProviderTest.php

示例12: setUp

 protected function setUp()
 {
     // Create a test database and table
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $schemaTool = new SchemaTool($this->em);
     $classes = array($this->em->getClassMetadata('Infinite\\FormBundle\\Tests\\Attachment\\Attachments\\StandardAttachment'));
     $schemaTool->createSchema($classes);
     // Prepare to create forms
     $sanitiser = new Sanitiser();
     $pathHelper = new PathHelper($sanitiser, array('Infinite\\FormBundle\\Tests\\Attachment\\Attachments\\StandardAttachment' => array('dir' => sys_get_temp_dir(), 'format' => 'test/{name}')));
     $this->uploader = new Uploader($sanitiser, $pathHelper);
     $this->factory = Forms::createFormFactoryBuilder()->addType(new AttachmentType('foobar', $this->em, $pathHelper, $this->uploader))->getFormFactory();
 }
开发者ID:Charlie-Lucas,项目名称:InfiniteFormBundle,代码行数:13,代码来源:AttachmentFieldTest.php

示例13: setUp

 protected function setUp()
 {
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $schemaTool = new SchemaTool($this->em);
     $classes = array($this->em->getClassMetadata(self::SINGLE_INT_ID_CLASS), $this->em->getClassMetadata(self::SINGLE_STRING_ID_CLASS), $this->em->getClassMetadata(self::COMPOSITE_ID_CLASS), $this->em->getClassMetadata(self::GROUPABLE_CLASS));
     try {
         $schemaTool->dropSchema($classes);
     } catch (\Exception $e) {
     }
     try {
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     parent::setUp();
 }
开发者ID:Herriniaina,项目名称:iVarotra,代码行数:15,代码来源:GenericEntityChoiceListTest.php

示例14: testEmbeddedIdentifierName

 public function testEmbeddedIdentifierName()
 {
     if (Version::compare('2.5.0') > 0) {
         $this->markTestSkipped('Applicable only for Doctrine >= 2.5.0');
         return;
     }
     $em = DoctrineTestHelper::createTestEntityManager();
     $query = $this->getMockBuilder('QueryMock')->setMethods(array('setParameter', 'getResult', 'getSql', '_doExecute'))->getMock();
     $query->expects($this->once())->method('setParameter')->with('ORMQueryBuilderLoader_getEntitiesByIds_id_value', array(1, 2, 3), Connection::PARAM_INT_ARRAY)->willReturn($query);
     $qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->setConstructorArgs(array($em))->setMethods(array('getQuery'))->getMock();
     $qb->expects($this->once())->method('getQuery')->willReturn($query);
     $qb->select('e')->from('Symfony\\Bridge\\Doctrine\\Tests\\Fixtures\\EmbeddedIdentifierEntity', 'e');
     $loader = new ORMQueryBuilderLoader($qb);
     $loader->getEntitiesByIds('id.value', array(1, '', 2, 3, 'foo'));
 }
开发者ID:symfony,项目名称:doctrine-bridge,代码行数:15,代码来源:ORMQueryBuilderLoaderTest.php

示例15: setUp

 protected function setUp()
 {
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $this->emRegistry = $this->createRegistryMock('default', $this->em);
     parent::setUp();
     $schemaTool = new SchemaTool($this->em);
     $classes = array($this->em->getClassMetadata(self::ITEM_GROUP_CLASS), $this->em->getClassMetadata(self::SINGLE_IDENT_CLASS), $this->em->getClassMetadata(self::SINGLE_IDENT_NO_TO_STRING_CLASS), $this->em->getClassMetadata(self::SINGLE_STRING_IDENT_CLASS), $this->em->getClassMetadata(self::SINGLE_ASSOC_IDENT_CLASS), $this->em->getClassMetadata(self::COMPOSITE_IDENT_CLASS), $this->em->getClassMetadata(self::COMPOSITE_STRING_IDENT_CLASS));
     try {
         $schemaTool->dropSchema($classes);
     } catch (\Exception $e) {
     }
     try {
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
 }
开发者ID:ABaldwinHunter,项目名称:symfony-clone,代码行数:16,代码来源:EntityTypeTest.php


注:本文中的Symfony\Bridge\Doctrine\Test\DoctrineTestHelper::createTestEntityManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。