public function testExtractFromManifest()
 {
     $packageValid = dirname(__FILE__) . '/samples/package/likertScaleInteraction_v1.0.0.zip';
     $parser = new PortableElementPackageParser($packageValid);
     $parser->setModel(new PciModel());
     $parser->validate();
     $model = $parser->getModel();
     $this->assertInstanceOf(PciModel::class, $model);
     $this->assertEquals('likertScaleInteraction', $model->getTypeIdentifier());
 }
 public function testExport()
 {
     $packageValid = dirname(__FILE__) . '/samples/package/likertScaleInteraction_v1.0.0';
     $pciModel = new PciModel('likertScaleInteraction', '1.0.0');
     $pciModel->exchangeArray(json_decode(file_get_contents($packageValid . DIRECTORY_SEPARATOR . PciModel::PCI_MANIFEST), true));
     $service = new PortableElementService();
     $service->setServiceLocator(ServiceManager::getServiceManager());
     $reflectionClass = new \ReflectionClass(PortableElementService::class);
     $reflectionMethod = $reflectionClass->getMethod('getRegistry');
     $reflectionMethod->setAccessible(true);
     $registry = $reflectionMethod->invoke($service, new PciModel());
     $registry->setSource($packageValid);
     $registry->register($pciModel);
     $exportDirectory = $registry->export($pciModel);
     $parser = new PortableElementPackageParser($exportDirectory);
     $parser->setModel(new PciModel());
     $source = $parser->extract();
     $original = $this->fillArrayWithFileNodes(new \DirectoryIterator($packageValid));
     $exported = $this->fillArrayWithFileNodes(new \DirectoryIterator($source));
     $this->assertEquals(preg_replace('/\\s+/', '', file_get_contents($packageValid . DIRECTORY_SEPARATOR . PciModel::PCI_MANIFEST)), preg_replace('/\\s+/', '', file_get_contents($source . DIRECTORY_SEPARATOR . PciModel::PCI_MANIFEST)));
     $this->assertTrue(empty($this->array_diff_assoc_recursive($original, $exported)));
     $registry->unregister($pciModel);
     \tao_helpers_File::delTree($source);
 }