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')); }
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()); }