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


PHP Test\WebTestCase类代码示例

本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Test\WebTestCase的典型用法代码示例。如果您正苦于以下问题:PHP WebTestCase类的具体用法?PHP WebTestCase怎么用?PHP WebTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getCommand

 protected function getCommand()
 {
     $kernel = WebTestCase::createKernel();
     $application = new Application($kernel);
     $adapter = new SymfonyFinder();
     $application->add(new FindCommand($adapter));
     return $application->find('fsearch:find');
 }
开发者ID:alexkomaralex,项目名称:file-search-bundle,代码行数:8,代码来源:FindCommandSymfonyFinderTest.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     $kernel = static::createKernel();
     $kernel->boot();
     $this->dm = $kernel->getContainer()->get('doctrine_mongodb')->getManager();
 }
开发者ID:renatomefidf,项目名称:sammui,代码行数:7,代码来源:ProtocolFilesControllerTest.php

示例3: setUp

 protected function setUp()
 {
     if (!class_exists('Twig_Environment')) {
         $this->markTestSkipped('Twig is not available.');
     }
     parent::setUp();
 }
开发者ID:neokensou,项目名称:symfony,代码行数:7,代码来源:WebTestCase.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     self::$kernel = static::createKernel();
     self::$kernel->boot();
     $this->entityManager = self::$kernel->getContainer()->get('doctrine')->getManager();
 }
开发者ID:qimnet,项目名称:update-tracker-bundle,代码行数:7,代码来源:UpdateTrackerRepositoryTest.php

示例5: createPersistentClient

 protected static function createPersistentClient($cookieName = 'test')
 {
     $client = parent::createClient();
     $client->getContainer()->get('session.storage.file')->deleteFile();
     $client->getCookieJar()->set(new Cookie(session_name(), $cookieName));
     return $client;
 }
开发者ID:hotfics,项目名称:lichess-old,代码行数:7,代码来源:AbstractAcceptanceTest.php

示例6: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->client = $this->createClient(['debug' => false]);
     $container = static::$kernel->getContainer();
     /** @var EntityManagerInterface[] $managers */
     $managers = $container->get('doctrine')->getManagers();
     foreach ($managers as $manager) {
         $metadata = $manager->getMetadataFactory()->getAllMetadata();
         if (!empty($metadata)) {
             $tool = new SchemaTool($manager);
             $tool->dropSchema($metadata);
             $tool->createSchema($metadata);
         }
     }
     $class = $container->getParameter('tree_house.keystone.model.user.class');
     $salt = uniqid();
     /** @var UserInterface $user */
     $user = new $class();
     $user->setEnabled(true);
     $user->setUsername('test');
     $user->addRole('ROLE_USER');
     $user->setSalt($salt);
     /** @var EncoderFactoryInterface $encoder */
     $encoder = $container->get('security.encoder_factory');
     $password = $encoder->getEncoder($class)->encodePassword(static::$password, $user->getSalt());
     $user->setPassword($password);
     /** @var ManagerRegistry $doctrine */
     $doctrine = static::$kernel->getContainer()->get('doctrine');
     $manager = $doctrine->getManagerForClass($class);
     $manager->persist($user);
     $manager->flush($user);
     $manager->refresh($user);
     $this->user = $user;
 }
开发者ID:treehouselabs,项目名称:keystone-bundle,代码行数:38,代码来源:WebTestCase.php

示例7: createClient

 /**
  * Creates a Client.
  *
  * @param array $options An array of options to pass to the createKernel class
  * @param array $server  An array of server parameters
  *
  * @return Client A Client instance
  */
 protected static function createClient(array $options = array(), array $server = array())
 {
     if (!self::$internalClient) {
         self::$internalClient = parent::createClient($options, $server);
         if (self::$db_isolation) {
             /** @var Client $client */
             $client = self::$internalClient;
             //workaround MyISAM search tables are not on transaction
             if (self::$db_reindex) {
                 $kernel = $client->getKernel();
                 $application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
                 $application->setAutoExit(false);
                 $options = array('command' => 'oro:search:reindex');
                 $options['--env'] = "test";
                 $options['--quiet'] = null;
                 $application->run(new \Symfony\Component\Console\Input\ArrayInput($options));
             }
             $client->startTransaction();
             $pdoConnection = Client::getPdoConnection();
             if ($pdoConnection) {
                 //set transaction level to 1 for entityManager
                 $connection = $client->createConnection($pdoConnection);
                 $client->getContainer()->set('doctrine.dbal.default_connection', $connection);
                 /** @var EntityManager $entityManager */
                 $entityManager = $client->getContainer()->get('doctrine.orm.entity_manager');
                 if (spl_object_hash($entityManager->getConnection()) != spl_object_hash($connection)) {
                     $reflection = new \ReflectionProperty('Doctrine\\ORM\\EntityManager', 'conn');
                     $reflection->setAccessible(true);
                     $reflection->setValue($entityManager, $connection);
                 }
             }
         }
     }
     return self::$internalClient;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:43,代码来源:WebTestCase.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $this->client = $this->createClient();
     $this->doctrine = $this->client->getContainer()->get('doctrine.orm.entity_manager');
     $this->fixturize($this->doctrine);
 }
开发者ID:aescarcha,项目名称:user-bundle,代码行数:7,代码来源:BaseTest.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     if (version_compare(Kernel::VERSION, '2.2.0', '<')) {
         $this->markTestSkipped('Does not work with Symfony2 2.1 due to a "host" parameter in the `routing.yml` file');
     }
 }
开发者ID:ABD-dev,项目名称:NelmioApiDocBundle,代码行数:7,代码来源:WebTestCase.php

示例10: tearDown

 public function tearDown()
 {
     if ($this->container !== null) {
         $this->container->get('doctrine')->getConnection()->close();
     }
     parent::tearDown();
 }
开发者ID:nicolaskern,项目名称:CCDNUserSecurityBundle,代码行数:7,代码来源:TestBase.php

示例11: tearDown

 /**
  * {@inheritDoc}
  */
 protected function tearDown()
 {
     parent::tearDown();
     if ($this->em instanceof \Doctrine\ORM\EntityManager) {
         $this->em->close();
     }
 }
开发者ID:skonsoft,项目名称:postal-address-bundle,代码行数:10,代码来源:WebTestCase.php

示例12: setUp

 /**
  * Setup test.
  *  @return null
  */
 public function setUp()
 {
     $this->app = new \AppKernel('test', true);
     $this->app->boot();
     $this->container = $this->app->getContainer();
     parent::setUp();
 }
开发者ID:bangpound,项目名称:elasticsearch-bundle,代码行数:11,代码来源:UshiosElasticSearchExtensionTest.php

示例13: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$client = static::createClient();
     self::$router = self::$kernel->getContainer()->get('router');
     self::$rootDir = self::$kernel->getContainer()->getParameter('kernel.root_dir');
     parent::setUpBeforeClass();
 }
开发者ID:gorvelyfab,项目名称:KoopaBaseAdminer,代码行数:7,代码来源:MediaControllerTest.php

示例14: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     foreach (glob($this->webDir . '/*{.xml,.xml.gz}', GLOB_BRACE) as $file) {
         unlink($file);
     }
 }
开发者ID:hyperlator,项目名称:PrestaSitemapBundle,代码行数:7,代码来源:DumpSitemapsCommandTest.php

示例15: tearDown

 protected function tearDown()
 {
     $this->truncateTables();
     $this->nullifyProperties();
     parent::tearDown();
     static::$kernel = null;
 }
开发者ID:supportyard,项目名称:framework-bundle,代码行数:7,代码来源:FunctionalTestCase.php


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