本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Test\WebTestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP WebTestCase::setUp方法的具体用法?PHP WebTestCase::setUp怎么用?PHP WebTestCase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Test\WebTestCase
的用法示例。
在下文中一共展示了WebTestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: setUp
public function setUp()
{
parent::setUp();
$this->client = $this->createClient();
$this->doctrine = $this->client->getContainer()->get('doctrine.orm.entity_manager');
$this->fixturize($this->doctrine);
}
示例3: setUp
/**
* Setup test.
* @return null
*/
public function setUp()
{
$this->app = new \AppKernel('test', true);
$this->app->boot();
$this->container = $this->app->getContainer();
parent::setUp();
}
示例4: setUp
public function setUp()
{
parent::setUp();
$kernel = static::createKernel();
$kernel->boot();
$this->dm = $kernel->getContainer()->get('doctrine_mongodb')->getManager();
}
示例5: setUp
protected function setUp()
{
parent::setUp();
self::$kernel = static::createKernel();
self::$kernel->boot();
$this->entityManager = self::$kernel->getContainer()->get('doctrine')->getManager();
}
示例6: setUp
public function setUp()
{
parent::setUp();
$this->setupCallableComparator();
$this->rebuildDatabase();
$this->client = static::$application->getKernel()->getContainer()->get('test.client');
}
示例7: 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');
}
}
示例8: setUp
protected function setUp()
{
if (!class_exists('Twig_Environment')) {
$this->markTestSkipped('Twig is not available.');
}
parent::setUp();
}
示例9: setUp
/**
* {@inheritDoc}
*/
public function setUp()
{
parent::setUp();
$this->newClient();
$this->prepareDatabase();
$this->prepareFactories();
$this->prepareTest();
}
示例10: setUp
public function setUp()
{
parent::setUp();
/** @var \Symfony\Bundle\FrameworkBundle\Client client */
$this->client = static::createClient();
$this->runCommand('doctrine:database:create');
$this->runCommand('doctrine:schema:update --force');
}
示例11: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
parent::setUp();
static::$kernel = static::createKernel();
static::$kernel->boot();
$this->em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->ipBannedRepository = $this->em->getRepository('JdrAppBundle:IpBanned');
}
示例12: setUp
/**
* {@inheritDoc}
*/
public function setUp()
{
static::$kernel = static::createKernel();
static::$kernel->boot();
$this->container = static::$kernel->getContainer();
$this->logger = $this->container->get('logger');
$this->dataModel = $this->container->get('DataModel');
parent::setUp();
}
示例13: setUp
protected function setUp()
{
parent::setUp();
$this->client = static::createClient();
$this->client->followRedirects();
$this->kern = $this->client->getKernel();
$this->container = $this->client->getContainer();
$this->em = $this->container->get('doctrine.orm.entity_manager');
}
示例14: setUp
public function setUp()
{
parent::setUp();
$this->client = static::createClient();
$this->storage = $this->client->getContainer()->get('my_drinks.recipe.storage');
$fs = new Filesystem();
$fs->remove($this->client->getContainer()->getParameter("recipes_upload_target_dir"));
$this->authenticateAsAdmin();
}
示例15: setUp
public function setUp()
{
parent::setUp();
$this->client = static::createClient();
$this->container = $this->client->getContainer();
$this->listener = new BreadcrumbListener($this->container);
$this->service = new BreadcrumbService($this->container);
$this->resolver = new ControllerResolver($this->container, new ControllerNameParser(static::createKernel()));
}