public function testManifestRunsToItsEnd()
 {
     $completed = false;
     $manifest = new YamlToEzPlatformContentTypeManifest(static::$repository);
     $this->assertInstanceOf(EventDrivenProcessor::class, $manifest->getProcessor());
     $manifest->getProcessor()->addListener(TransferEvents::POST_PROCEDURE, function () use(&$completed) {
         $completed = true;
     });
     $manifest->configureProcessor($manifest->getProcessor());
     $runner = new ManifestRunner($manifest);
     $runner->run($manifest);
     $this->assertTrue($completed);
     $this->assertEquals('yaml_to_ezplatform_contenttype', $manifest->getName());
 }
Esempio n. 2
0
 /**
  * Tests run method.
  */
 public function testRun()
 {
     $runner = new ManifestRunner();
     $finished = false;
     /** @var object $manifestProphecy */
     $manifestProphecy = $this->prophesize('Transfer\\Manifest\\ManifestInterface');
     $manifestProphecy->configureProcedureBuilder(Argument::type('object'))->willReturn(null);
     $manifestProphecy->getProcessor()->willReturn(new SequentialProcessor());
     $manifestProphecy->configureProcessor(Argument::type('object'))->will(function ($args) use(&$finished) {
         /** @var EventDrivenProcessor $processor */
         $processor = $args[0];
         $processor->addListener(TransferEvents::POST_PROCESS, function () use(&$finished) {
             $finished = true;
         });
     });
     /** @var ManifestInterface $manifest */
     $manifest = $manifestProphecy->reveal();
     $runner->setEventDispatcher(new EventDispatcher());
     $runner->run($manifest);
     $this->assertTrue($finished);
 }
 public function testManifestRun()
 {
     // design/plainsite location id
     $parentLocationId = 56;
     $completed = false;
     $location = static::$repository->getLocationService()->loadLocation($parentLocationId);
     $children = static::$repository->getLocationService()->loadLocationChildren($location);
     $this->assertLessThan(4, $children->totalCount);
     $manifest = new GoogleNewsToEzPlatformContentManifest(static::$repository, array('url' => 'https://news.google.com/news?cf=all&hl=en&ned=us&topic=t&output=rss', 'location_id' => $parentLocationId));
     $this->assertInstanceOf(EventDrivenProcessor::class, $manifest->getProcessor());
     $manifest->getProcessor()->addListener(TransferEvents::POST_PROCEDURE, function () use(&$completed) {
         $completed = true;
     });
     $manifest->configureProcessor($manifest->getProcessor());
     $runner = new ManifestRunner($manifest);
     $runner->run($manifest);
     $this->assertTrue($completed);
     $this->assertEquals('googlenews_to_ezplatform_content', $manifest->getName());
     $location = static::$repository->getLocationService()->loadLocation($parentLocationId);
     $children = static::$repository->getLocationService()->loadLocationChildren($location);
     $this->assertGreaterThan(4, $children->totalCount);
 }
Esempio n. 4
0
 /**
  * @param ManifestInterface $manifest Manifest to run
  */
 public function runManifest(ManifestInterface $manifest)
 {
     $runner = new ManifestRunner();
     $runner->run($manifest);
 }