public function testMatchedSimpleValues() { foreach (array(array('{ccm:export:page:/ok/here/we-go}', '/ok/here/we-go', '\\Concrete\\Core\\Backup\\ContentImporter\\ValueInspector\\Item\\PageItem'), array('{ccm:export:file:house.jpg}', 'house.jpg', '\\Concrete\\Core\\Backup\\ContentImporter\\ValueInspector\\Item\\FileItem'), array('{ccm:export:pagetype:blog}', 'blog', '\\Concrete\\Core\\Backup\\ContentImporter\\ValueInspector\\Item\\PageTypeItem'), array('{ccm:export:pagefeed:rss}', 'rss', '\\Concrete\\Core\\Backup\\ContentImporter\\ValueInspector\\Item\\PageFeedItem'), array('{ccm:export:image:my_cool_pic.jpg}', 'my_cool_pic.jpg', '\\Concrete\\Core\\Backup\\ContentImporter\\ValueInspector\\Item\\PictureItem'), array('<concrete-picture file="avatar.jpg"></concrete-picture>', 'avatar.jpg', '\\Concrete\\Core\\Backup\\ContentImporter\\ValueInspector\\Item\\PictureItem')) as $test) { $inspector = new \Concrete\Core\Backup\ContentImporter\ValueInspector\ValueInspector($test[0]); $item = $inspector->getMatchedItem(); $this->assertEquals($test[1], $item->getReference()); $this->assertInstanceOf($test[2], $item); } }
public function testMatchedObjects() { $this->createData(); $inspector = new \Concrete\Core\Backup\ContentImporter\ValueInspector\ValueInspector('{ccm:export:page:/page-3}'); $o = $inspector->getMatchedItem(); $this->assertInstanceOf('\\Concrete\\Core\\Page\\Page', $o->getContentObject()); $this->assertEquals('Page 3', $o->getContentObject()->getCollectionName()); $inspector = new \Concrete\Core\Backup\ContentImporter\ValueInspector\ValueInspector('{ccm:export:pagefeed:blog}'); $o = $inspector->getMatchedItem(); $this->assertInstanceOf('\\Concrete\\Core\\Page\\Feed', $o->getContentObject()); $this->assertEquals(1, $o->getContentObject()->getID()); $this->assertEquals('blog', $o->getContentObject()->getHandle()); }