/** @test */ public function shoulLoadCliCommand() { $kernel = $this->mockFactory->getKernelMock(array('log')); $cli = new Cli($kernel); $kernel->expects($this->at(2))->method('log')->with($this->stringContains('Done')); $cli->handle(array('c' => 'widget.WithCli.simple')); }
public function testThrowConfigurationParseError() { $kernel = $this->mockFactory->getKernelMock(array('getParam', 'handleError')); $kernel->expects($this->once())->method('handleError')->with($this->stringContains('Parse error on line 2:')); // prepare Kernel and try to get config from invalid json $kernel->setParams(array('conf' => 'not-valid')); $kernel->getConfig(); }
/** * @test */ public function shouldMergeDataFromMultiplePhpFiles() { $kernel = $this->mockFactory->getKernelMock(array('a')); $widgetProviderTestCase = new WidgetProvider($kernel); $widget = $widgetProviderTestCase->createWidget(array('php' => array('simple-data-a.php', 'simple-data-b.php'))); $wData = $widget->get('data'); $this->assertEquals('This is A', $wData['a']); $this->assertEquals('This is B', $wData['b']); }
public function testRenderWithOneWidget() { $kernelMock = $this->mockFactory->getKernelMock(); $kernelMock->expects($this->any())->method('getConfig')->will($this->returnValue(array('widgets' => array(array('name' => 'test')), 'template' => 'test'))); $kernelMock->expects($this->once())->method('findFileOnPath')->will($this->returnValue(__DIR__ . '/../../templates/empty.phtml')); $widgetMock = $this->getWidgetMock($kernelMock); $widgetProviderMock = $this->getWidgetMockProvider($kernelMock); $widgetProviderMock->injectMock($widgetMock); $dashboard = new Dashboard($kernelMock, $widgetProviderMock); $dashboard->render(); }
/** * @param array $data * * @return Hoborg\Dashboard\Widget */ private function createWidget(array $data = array()) { $kernel = $this->mockFactory->getKernelMock(); $widget = new Widget($kernel, $data); return $widget; }
public function setup() { $this->mockFactory = new MockFactory($this); $this->kernel = $this->mockFactory->getKernelMock(array('log')); }