Example #1
0
 /**
  * @Given I run Sylius Install Load Sample Data command
  */
 public function iRunSyliusInstallSampleDataCommand()
 {
     $this->application = new Application($this->kernel);
     $this->application->add(new InstallSampleDataCommand());
     $this->command = $this->application->find('sylius:install:sample-data');
     $this->tester = new CommandTester($this->command);
 }
Example #2
0
 protected function setUp()
 {
     $this->initClient();
     $kernel = self::getContainer()->get('kernel');
     $this->application = new Application($kernel);
     $this->application->add(new CronCommand());
 }
 protected function setUp()
 {
     parent::setUp();
     $this->application = new Application(self::getKernel());
     $this->application->add(new LoadDataFixturesDoctrineCommand());
     $this->application->add(new CreateSchemaDoctrineCommand());
     $this->createDB();
 }
Example #4
0
 protected function setUp()
 {
     $this->initClient();
     $this->loadFixtures(['Oro\\Bundle\\CronBundle\\Tests\\Functional\\Command\\DataFixtures\\LoadScheduleData']);
     $kernel = self::getContainer()->get('kernel');
     $this->application = new Application($kernel);
     $this->application->add(new CronCommand());
 }
 public function doSetUp()
 {
     /* @var \Modera\FileRepositoryBundle\Repository\FileRepository $fr */
     self::$fileRepository = self::$container->get('modera_file_repository.repository.file_repository');
     $repositoryConfig = array('filesystem' => 'dummy_tmp_fs', 'interceptors' => [Interceptor::ID], 'thumbnail_sizes' => array(array('width' => 215, 'height' => 285), array('width' => 32, 'height' => 32)));
     self::$fileRepository->createRepository('dummy_repo1', $repositoryConfig, 'Bla bla');
     $this->application = new Application(self::$container->get('kernel'));
     $this->application->add(new GenerateThumbnailsCommand());
 }
 public function setUp()
 {
     $this->buildDir = new vfsStreamDirectory('build');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($this->buildDir);
     $this->filesystem = m::mock('Symfony\\Component\\Filesystem\\Filesystem');
     $this->application = new Application($this->getMockKernel());
     $this->application->add(new CleanCommand($this->filesystem, $this->buildDir->url()));
 }
 protected function setUp()
 {
     parent::setUp();
     $this->createKernel();
     $this->bootKernel();
     $this->application = new Application(self::$kernel);
     $this->application->add(new SchedulerCommand());
     $this->queue = $this->container->get('syrup.queue_factory')->get(KeboolaOrchestratorBundle::SYRUP_COMPONENT_NAME);
 }
 public function setUp()
 {
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldIgnoreMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->with('transformcore.phe.analytics.extractor')->andReturn($this->mockExtractionService());
     $kernel->shouldReceive('get')->withAnyArgs()->andReturnSelf();
     $this->instance = new Application($kernel);
     $this->instance->add(new DailyDataExtractCommand());
 }
 public function setUp()
 {
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldIgnoreMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->with('transformcore.phe.hayapi.questionnaire')->andReturn($this->mockQuestionnaireService());
     $kernel->shouldReceive('get')->withAnyArgs()->andReturnSelf();
     $this->instance = new Application($kernel);
     $this->instance->add(new ExpireDeadQuizCommand());
 }
 protected function setUp()
 {
     parent::setUp();
     $this->createKernel();
     $this->bootKernel();
     $this->application = new Application(self::$kernel);
     $this->application->add(new JobCommand());
     $this->syrupJobMapper = $this->container->get('syrup.elasticsearch.current_component_job_mapper');
     //->get(KeboolaOrchestratorBundle::SYRUP_COMPONENT_NAME);
 }
Example #11
0
 protected function setUp()
 {
     self::bootKernel();
     $this->application = new Application(self::$kernel);
     // Register doctrine bundles
     $this->application->add(new LoadDataFixturesCommand($this->application->getKernel()->getContainer()->get('doctrine'), $this->application->getKernel()->getContainer()->get('hautelook_alice.fixtures.loader'), $this->application->getKernel()->getContainer()->get('hautelook_alice.doctrine.finder')));
     $this->doctrineManager = $this->application->getKernel()->getContainer()->get('doctrine')->getManager();
     $this->application->setAutoExit(false);
     $this->runConsole("doctrine:schema:drop", ["--force" => true]);
     $this->runConsole("doctrine:schema:create");
 }
 public function setUp()
 {
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldDeferMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('saveCounty')->once()->withAnyArgs()->andReturn((new County('Foo', 'Bar'))->setLastUpdated(new \DateTime())->setId(1));
     $kernel->shouldReceive('saveCounty')->withAnyArgs()->andReturn((new County('Foo', 'Bar'))->setId(PHP_INT_MAX));
     $this->instance = new Application($kernel);
     $this->instance->add(new ImportCountiesCommand());
 }
Example #13
0
 /**
  * SetUp called before each tests, setting up the environment (application, globally used mocks)
  */
 public function setUp()
 {
     $kernel = $this->getMockBuilder('\\Symfony\\Component\\HttpKernel\\Kernel')->disableOriginalConstructor()->getMock();
     $this->application = new Application($kernel);
     $this->predisClient = $this->getMock('\\Predis\\Client');
     $this->phpredisClient = $this->getMockBuilder('\\Snc\\RedisBundle\\Client\\Phpredis\\Client')->disableOriginalConstructor()->getMock();
     $this->container = $this->getMock('\\Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $command = $this->getCommand();
     $this->application->add($command);
     $command->setContainer($this->container);
 }
 public function setUp()
 {
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldIgnoreMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->with('transformcore.phe.exporter.datahashing')->andReturn(\Mockery::mock('TransformCore\\PHE\\ExporterBundle\\Service\\DataObfuscationService')->shouldIgnoreMissing());
     $kernel->shouldReceive('get')->with('transformcore.phe.hayapi.questionnaire')->andReturn($this->mockQuestionnaireService());
     $kernel->shouldReceive('get')->with('logger')->andReturn(\Mockery::mock('Psr\\Log\\LoggerInterface')->shouldIgnoreMissing());
     $this->instance = new Application($kernel);
     $this->instance->add(new PIDDataObfuscationCommand());
 }
 public function setUp()
 {
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldIgnoreMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->with('transformcore.phe.exporter.upload')->andReturn($this->mockUploadService());
     $kernel->shouldReceive('get')->with('export_path')->andReturn('exports');
     $kernel->shouldReceive('get')->withAnyArgs()->andReturnSelf();
     $this->instance = new Application($kernel);
     $this->instance->add(new FileUploadCommand());
 }
Example #16
0
 protected function setUp()
 {
     $this->initClient();
     $this->loadFixtures(['Oro\\Bundle\\UserBundle\\Tests\\Functional\\DataFixtures\\LoadCommandUserCreateUpdateData']);
     $this->application = new Application($this->client->getKernel());
     $this->application->setAutoExit(false);
     $this->application->add(new CreateUserCommand());
     $this->application->add(new UpdateUserCommand());
     $this->businessUnits = ['bu1' => $this->getReference('bu1')];
     $this->organizations = ['org1' => $this->getReference('org1'), 'org2' => $this->getReference('org2'), 'org3' => $this->getReference('org3')];
     $this->userManager = $this->getContainer()->get('oro_user.manager');
 }
 public function testExecute()
 {
     $supervisor = $this->getMockBuilder('Supervisor\\Supervisor')->disableOriginalConstructor()->getMock();
     $supervisor->expects($this->any())->method('checkConnection')->willReturn(true);
     $supervisor->expects($this->any())->method('getName')->willReturn('niceNameFoo');
     $this->supervisorManager->expects($this->any())->method('getSupervisors')->willReturn(array($supervisor));
     $this->application->add(new SupervisorListCommand());
     $command = $this->application->find('abc:supervisor:list');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertRegExp('/Instance: niceNameFoo/', $commandTester->getDisplay());
 }
 public function setUp()
 {
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldDeferMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('findByEntityCode')->withAnyArgs()->andReturn(new DistrictCouncil('FOO', 'BAR'));
     $kernel->shouldReceive('saveParishCouncil')->once()->withAnyArgs()->andReturn((new ParishCouncil('Foo', 'Bar'))->setLastUpdated(new \DateTime())->setId(1));
     $kernel->shouldReceive('saveParishCouncil')->withAnyArgs()->andReturn((new ParishCouncil('Foo', 'Bar'))->setId(PHP_INT_MAX));
     $this->instance = new Application($kernel);
     $this->instance->add(new ImportParishCouncilCommand());
 }
Example #19
0
 /**
  * SetUp called before each tests, setting up the environment (application, globally used mocks)
  */
 public function setUp()
 {
     $this->container = $this->getMock('\\Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $kernel = $this->getMockBuilder('\\Symfony\\Component\\HttpKernel\\Kernel')->disableOriginalConstructor()->getMock();
     $kernel->expects($this->once())->method('getBundles')->will($this->returnValue(array()));
     $kernel->expects($this->once())->method('getContainer')->will($this->returnValue($this->container));
     $this->application = new Application($kernel);
     $this->predisClient = $this->getMock('\\Predis\\Client');
     $this->phpredisClient = $this->getMockBuilder('PhpredisClient')->disableOriginalConstructor()->getMock();
     $command = $this->getCommand();
     $this->application->add($command);
     $command->setContainer($this->container);
 }
 /**
  * Test execute with all the options
  *
  * @group command
  */
 public function testExecute()
 {
     static::$application->add(new ImportTranslationsCommand());
     $command = static::$application->find("lexik:translations:import");
     $command->setContainer(static::$kernel->getContainer());
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'bundle' => 'LexikTranslationBundle', '--cache-clear' => true, '--force' => true, '--locales' => array('en', 'fr')));
     $resultLines = explode("\n", $commandTester->getDisplay());
     $this->assertEquals('# LexikTranslationBundle:', $resultLines[0]);
     $this->assertLanguageDumped($resultLines[1]);
     $this->assertLanguageDumped($resultLines[2]);
     $this->assertEquals('Removing translations cache files ...', $resultLines[3]);
 }
 public function testExecute()
 {
     $application = new Application($this->kernel);
     $application->add(new QueueCreateCommand());
     $command = $application->find('jobqueue:create');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'queue-name' => 'my:queue1', '--timeout' => 10), array('interactive' => false));
     $application->add(new QueueDeleteCommand());
     $command = $application->find('jobqueue:delete');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'queue-name' => 'my:queue1'), array('interactive' => false));
     $this->assertRegExp('/Queue "my:queue1" deleted/', $commandTester->getDisplay(), 'Deleted queue');
 }
 public function setUp()
 {
     self::bootKernel();
     $this->taskRunner = self::$kernel->getContainer()->get('task.runner');
     $this->taskScheduler = self::$kernel->getContainer()->get('task.scheduler');
     $this->taskRepository = self::$kernel->getContainer()->get('task.storage.task');
     $this->taskExecutionRepository = self::$kernel->getContainer()->get('task.storage.task_execution');
     $command = $this->getCommand();
     $this->application = new Application(self::$kernel);
     $this->application->add($command);
     $this->command = $this->application->find($command->getName());
     $this->commandTester = new CommandTester($this->command);
     $this->purgeDatabase();
 }
 /**
  * Test execute with all the options
  *
  * @group command
  */
 public function testExecute()
 {
     static::$application->add(new ImportTranslationsCommand());
     $command = static::$application->find("lexik:translations:import");
     $command->setContainer(static::$kernel->getContainer());
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName(), 'bundle' => 'LexikTranslationBundle', '--cache-clear' => true, '--force' => true, '--locales' => array('en', 'fr')));
     $resultLines = explode("\n", $commandTester->getDisplay());
     $this->assertEquals('# LexikTranslationBundle:', $resultLines[0]);
     $this->assertRegExp('/Using dir (.)+(Lexik|Lexik\\/Bundle\\/)TranslationBundle\\/Resources\\/translations to lookup translation files/', $resultLines[1]);
     $this->assertRegExp('/translations\\/LexikTranslationBundle\\.((fr)|(en))\\.yml" \\.\\.\\. 17 translations/', $resultLines[2]);
     $this->assertRegExp('/translations\\/LexikTranslationBundle\\.((fr)|(en))\\.yml" \\.\\.\\. 17 translations/', $resultLines[3]);
     $this->assertEquals('Removing translations cache files ...', $resultLines[4]);
 }
 public function setUp()
 {
     $this->userIdentifier = uniqid() . '@local';
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldDeferMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('fos_user.util.user_manipulator')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('create')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getApiKey')->withAnyArgs()->andReturn(md5($this->userIdentifier));
     $kernel->shouldReceive('getSecret')->withAnyArgs()->andReturn(md5($this->userIdentifier));
     $this->instance = new Application($kernel);
     $this->instance->add(new CreateUserCommand());
 }
    /**
     * @test
     * @group functional
     */
    public function execute()
    {
        $application = new Application(static::$kernel);
        $application->add(new SyncSchemaCommand());
        $command = $application->find('eav:schema:sync');
        $commandTester = new CommandTester($command);
        // FIRST PASS
        $commandTester->execute(array('command' => $command->getName()));
        $output = <<<OUTPUT
+-----------+------------------------------------------------+
| Created:  | Padam87\\AttributeBundle\\Tests\\Model\\Subscriber |
+-----------+------------------------------------------------+
| Existing: |                                                |
+-----------+------------------------------------------------+

OUTPUT;
        $this->assertSame(str_replace(PHP_EOL, "\n", $output), $commandTester->getDisplay(true));
        // SECOND PASS
        $commandTester->execute(array('command' => $command->getName()));
        $output = <<<OUTPUT
+-----------+------------------------------------------------+
| Created:  |                                                |
+-----------+------------------------------------------------+
| Existing: | Padam87\\AttributeBundle\\Tests\\Model\\Subscriber |
+-----------+------------------------------------------------+

OUTPUT;
        $this->assertSame(str_replace(PHP_EOL, "\n", $output), $commandTester->getDisplay(true));
    }
 protected function setCommand()
 {
     $mockedKernel = $this->getMock('Symfony\\Component\\HttpKernel\\Kernel', array(), array(), '', false);
     $application = new Application($mockedKernel);
     $application->add(new WurstCommand());
     $this->command = $application->find('wurst:print');
 }
 /**
  * test saving entity with file property from parent abstract uploadable class
  */
 public function testFileSaveUpload()
 {
     $client = $this->createClient();
     $this->importDatabaseSchema();
     $file = new File();
     $existsFile = new \Symfony\Component\HttpFoundation\File\File(__DIR__ . '/../Fixtures/files/text.txt');
     $file->setTitle('new file')->setDate(new \DateTime('2013-04-04'))->setFile($existsFile);
     $this->getEntityManager()->persist($file);
     $this->getEntityManager()->flush();
     $this->assertSame($file->getFile(), array('fileName' => '/File/file/2013/1.txt', 'originalName' => 'text.txt', 'mimeType' => 'text/plain', 'size' => 9, 'path' => '/file/File/file/2013/1.txt'));
     unset($file);
     $this->getEntityManager()->clear();
     $this->getKernel()->shutdown();
     $client = $this->createClient(array('config' => 'default_newfilepath.yml'));
     $application = new Application($client->getKernel());
     $application->add(new RepairFileDataCommand());
     $command = $application->find('iphp:filestore:repair');
     $commandTester = new CommandTester($command);
     //using web directory setted in config/default.yml
     $commandTester->execute(array('command' => $command->getName(), '--entity' => 'TestXmlConfigBundle:File', '--field' => 'file', '--force' => 1, '--webdir' => realpath($this->getContainer()->getParameter('kernel.test_env_dir') . '/web/')));
     $newFile = $this->getEntityManager()->getRepository('TestXmlConfigBundle:File')->findOneByTitle('new file');
     $this->assertSame($newFile->getFile(), array('fileName' => '/1/new-file.txt', 'originalName' => 'text.txt', 'mimeType' => 'text/plain', 'size' => 9, 'path' => '/other/uploads/1/new-file.txt'));
     unset($newFile);
     unset($commandTester);
     unset($command);
     unset($application);
     $this->getEntityManager()->clear();
     $this->getKernel()->shutdown();
 }
 public function setUp()
 {
     $this->client = static::createClient();
     $kernel = new \AppKernel("test", true);
     $kernel->boot();
     $this->application = new Application($kernel);
     $this->application->setAutoExit(false);
     $this->runConsole("doctrine:da:dr", array("--force" => true));
     $this->runConsole("doctrine:da:cr");
     $command = new CreateSchemaDoctrineCommand();
     $this->application->add($command);
     $input = new ArrayInput(array('command' => 'doctrine:schema:create --force'));
     $command->run($input, new ConsoleOutput());
     $this->runConsole("doctrine:fixtures:load", array("--fixtures" => __DIR__ . "/../../DataFixtures"));
     $this->entityManager = static::$kernel->getContainer()->get('doctrine')->getManager();
 }
 public function setUp()
 {
     $kernel = \Mockery::mock('Symfony\\Component\\HttpKernel\\Kernel')->shouldDeferMissing();
     $kernel->shouldReceive('getKernel')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('getContainer')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('get')->withAnyArgs()->andReturnSelf();
     $kernel->shouldReceive('saveAuthority')->once()->withAnyArgs()->andReturn((new Authority())->setPostcode('Bar')->setLastUpdated(new \DateTime())->setId(1));
     $kernel->shouldReceive('saveAuthority')->withAnyArgs()->andReturn((new Authority())->setPostcode('Bar')->setId(PHP_INT_MAX));
     $kernel->shouldReceive('findByEntityCode')->withAnyArgs()->once()->andReturn(new County('CODE', 'NAME'));
     $kernel->shouldReceive('findByEntityCode')->withAnyArgs()->once()->andReturn(new DistrictCouncil('CODE', 'NAME'));
     $kernel->shouldReceive('findByEntityCode')->withAnyArgs()->once()->andReturn(new LocalHealthAuthority('CODE', 'NAME'));
     $kernel->shouldReceive('findByEntityCode')->withAnyArgs()->once()->andReturn(new ElectoralWard('CODE', 'NAME'));
     $kernel->shouldReceive('findByEntityCode')->withAnyArgs()->once()->andReturn(new ParishCouncil('CODE', 'NAME'));
     $this->instance = new Application($kernel);
     $this->instance->add(new ImportAuthorityCommand());
 }
 /**
  * @return \Symfony\Component\Console\Command\Command
  */
 private function getCommandInstance()
 {
     $kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel')->disableOriginalConstructor()->getMock();
     $app = new Application($kernel);
     $app->add(new GenerateProductCommand());
     return $app->find('sonata:product:generate');
 }