當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Test\DoctrineTestHelper類代碼示例

本文整理匯總了PHP中Symfony\Bridge\Doctrine\Test\DoctrineTestHelper的典型用法代碼示例。如果您正苦於以下問題:PHP DoctrineTestHelper類的具體用法?PHP DoctrineTestHelper怎麽用?PHP DoctrineTestHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DoctrineTestHelper類的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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。