/**
  * Setup before every test.
  */
 protected function setUp()
 {
     $kernel = self::createClient()->getKernel();
     $this->manager = $kernel->getContainer()->get('es.manager');
     // Clear any residual data and create indexes.
     $this->manager->getConnection()->dropAndCreateIndex();
     /** @var Application $application */
     $application = new Application($kernel);
     $application->add(new SyncParametersCommand());
     $this->command = $application->find('ongr:sync:provide:parameter');
     $this->commandTester = new CommandTester($this->command);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->manager = $this->getServiceContainer()->get('es.manager');
     $this->manager->getConnection()->dropAndCreateIndex();
     // There is something wrong with ElasticsearchTestCase method getDataArray,
     // if we don't create in here all test data, it's not existing when test is run.
     $content = new Pair();
     $content->setId('name0');
     $content->setValue('will not be here');
     $this->manager->persist($content);
     $this->manager->commit();
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     static::bootKernel(['environment' => 'test_container_creation']);
     /** @var ContainerInterface container */
     $this->container = static::$kernel->getContainer();
     /** @var Manager $manager */
     $this->manager = $this->container->get('es.manager');
     $this->manager->getConnection()->dropAndCreateIndex();
     // There is something wrong with ElasticsearchTestCase method getDataArray,
     // if we don't create in here all test data, it's not existing when test is run.
     $content = new Setting();
     $content->setId('default_name0');
     $content->setName('name0');
     $content->setProfile('default');
     $content->setDescription('this should be updated');
     $content->setType(Setting::TYPE_STRING);
     $content->setData((object) ['value' => 'test1']);
     $this->manager->persist($content);
     $this->manager->commit();
 }
 /**
  * Populates elasticsearch with data.
  *
  * @param Manager $manager
  * @param array   $data
  */
 protected function populateElasticsearchWithData($manager, array $data)
 {
     if (!empty($data)) {
         foreach ($data as $type => $documents) {
             foreach ($documents as $document) {
                 $manager->getConnection()->bulk('index', $type, $document);
             }
         }
         $manager->commit();
     }
 }