Gets the data source manager.
public getDataSourceManager ( ) : |
||
리턴 |
public function testEnvironmentEvent() { $dsm = $this->getMockBuilder('\\Yosymfony\\Spress\\Core\\DataSource\\DataSourceManager')->getMock(); $cm = $this->getMockBuilder('\\Yosymfony\\Spress\\Core\\ContentManager\\Converter\\ConverterManager')->getMock(); $gm = $this->getMockBuilder('\\Yosymfony\\Spress\\Core\\ContentManager\\Generator\\GeneratorManager')->getMock(); $renderizer = $this->getMockBuilder('\\Yosymfony\\Spress\\Core\\ContentManager\\Renderizer\\RenderizerInterface')->getMock(); $io = $this->getMockBuilder('\\Yosymfony\\Spress\\Core\\IO\\IOInterface')->getMock(); $dw = $this->getMockBuilder('\\Yosymfony\\Spress\\Core\\DataWriter\\DataWriterInterface')->getMock(); $configValues = ['name' => 'Yo! Symfony']; $event = new EnvironmentEvent($dsm, $dw, $cm, $gm, $renderizer, $io, $configValues); $this->assertInstanceOf('\\Yosymfony\\Spress\\Core\\DataSource\\DataSourceManager', $event->getDataSourceManager()); $this->assertInstanceOf('\\Yosymfony\\Spress\\Core\\DataWriter\\DataWriterInterface', $event->getDataWriter()); $this->assertInstanceOf('\\Yosymfony\\Spress\\Core\\ContentManager\\Converter\\ConverterManager', $event->getConverterManager()); $this->assertInstanceOf('\\Yosymfony\\Spress\\Core\\ContentManager\\Generator\\GeneratorManager', $event->getGeneratorManager()); $this->assertInstanceOf('\\Yosymfony\\Spress\\Core\\ContentManager\\Renderizer\\RenderizerInterface', $event->getRenderizer()); $this->assertInstanceOf('\\Yosymfony\\Spress\\Core\\IO\\IOInterface', $event->getIO()); $values = $event->getConfigValues(); $this->assertTrue(is_array($values)); $this->assertArrayHasKey('name', $values); $this->assertEquals('Yo! Symfony', $values['name']); $values['title'] = 'My blog page'; $event->setConfigValues($values); $this->assertArrayHasKey('name', $configValues); $this->assertEquals('My blog page', $configValues['title']); }
public function onStart(EnvironmentEvent $event) { $dsm = $event->getDataSourceManager(); $item = new Item('Content from item in memory data source', 'memory-datasource.txt'); $item->setPath('memory-datasource.txt', Item::SNAPSHOT_PATH_RELATIVE); $memoryDataSource = new MemoryDataSource(); $memoryDataSource->addItem($item); $dsm->setDataSource('memory-plugin', $memoryDataSource); }