setModel(new PciModel()); $this->assertTrue($parser->validate($packageValid)); } public function testExtractFromManifest() { $packageValid = dirname(__FILE__) . '/samples/package/likertScaleInteraction_v1.0.0.zip'; $parser = new PciPackagerParser(); $parser->setModel(new PciModel()); $parser->validate($packageValid); $manifest = $parser->getManifestContent($packageValid); $this->assertTrue(is_array($manifest)); $this->assertEquals(11, count($manifest)); $this->assertEquals('likertScaleInteraction', $manifest['typeIdentifier']); } public function testValidateWrongModel() { $this->expectException(PortableElementParserException::class); $packageValid = dirname(__FILE__) . '/samples/package/likertScaleInteraction_v1.0.0.zip'; $parser = new PciPackagerParser(); $parser->setModel(new IMSPciModel()); $this->assertFalse($parser->validate($packageValid)); } public function testValidateIms() { $packageValid = dirname(__FILE__) . '/samples/package/imsLikert_v0.1.0.zip'; $parser = new PciPackagerParser(); $parser->setModel(new IMSPciModel()); $this->assertTrue($parser->validate($packageValid)); } public function testExtractFromManifestIms() { $packageValid = dirname(__FILE__) . '/samples/package/imsLikert_v0.1.0.zip'; $parser = new PciPackagerParser(); $parser->setModel(new IMSPciModel()); $parser->validate($packageValid); $manifest = $parser->getManifestContent($packageValid); $this->assertTrue(is_array($manifest)); $this->assertEquals(12, count($manifest)); $this->assertEquals('likertInteraction', $manifest['typeIdentifier']); } public function testValidateWrongModelIms() { $this->expectException(PortableElementParserException::class); $packageValid = dirname(__FILE__) . '/samples/package/imsLikert_v0.1.0.zip'; $parser = new PciPackagerParser(); $parser->setModel(new PciModel()); $this->assertFalse($parser->validate($packageValid)); } }