Collection matching of a item.
public getCollectionForItem ( Yosymfony\Spress\Core\DataSource\ItemInterface $item ) : Yosymfony\Spress\Core\ContentManager\Collection\CollectionInterface | ||
$item | Yosymfony\Spress\Core\DataSource\ItemInterface | |
return | Yosymfony\Spress\Core\ContentManager\Collection\CollectionInterface |
public function testDefaultCollection() { $cm = new CollectionManager(); $this->assertCount(1, $cm->getCollectionItemCollection()); $item = new Item('Test of content', 'member-1.html'); $item->setPath('member-1.html', Item::SNAPSHOT_PATH_RELATIVE); $collection = $cm->getCollectionForItem($item); $this->assertEquals('pages', $collection->getName()); $this->assertEquals('', $collection->getPath()); }
public function testDefaultCollection() { $cm = new CollectionManager(); $cm->addCollection(new Collection('events', '_events', ['output' => true])); $item = new Item('Test of content', 'member-1.html', []); $item->setPath('member-1.html', Item::SNAPSHOT_PATH_RELATIVE); $collection = $cm->getCollectionForItem($item); $this->assertEquals('pages', $collection->getName()); $this->assertEquals('', $collection->getPath()); }