hasItem() 공개 메소드

This method is for internal use only and should never be called directly.
public hasItem ( string $path ) : boolean
$path string Relative path of the content
리턴 boolean
예제 #1
0
 public function testWriteItem()
 {
     $item = new Item('Test content', 'my-id');
     $item->setPath('index.html', Item::SNAPSHOT_PATH_PERMALINK);
     $item->setPath('index.html', Item::SNAPSHOT_PATH_RELATIVE);
     $dw = new MemoryDataWriter();
     $dw->write($item);
     $this->assertTrue($dw->hasItem('index.html'));
     $this->assertEquals(1, $dw->countItems());
     $this->assertEquals('Test content', $dw->getItem('index.html')->getContent());
     $this->assertCount(1, $dw->getItems());
     $this->assertFalse($dw->hasItem('not-found-path.html'));
 }
예제 #2
0
 public function testParseWithDrafts()
 {
     $dw = new MemoryDataWriter();
     $spress = new Spress();
     $spress['spress.config.site_dir'] = __DIR__ . '/fixtures/project';
     $spress['spress.config.drafts'] = true;
     $spress['spress.dataWriter'] = $dw;
     $spress->parse();
     $this->assertCount(18, $dw->getItems());
     $this->assertTrue($dw->hasItem('books/2013/09/19/new-book/index.html'));
     $this->assertContains('<!DOCTYPE HTML>', $dw->getItem('books/2013/09/19/new-book/index.html')->getContent());
 }