getCollectionForItem() 공개 메소드

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
리턴 Yosymfony\Spress\Core\ContentManager\Collection\CollectionInterface
예제 #1
0
 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());
 }
예제 #2
0
 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());
 }