/** * Tests the collect() method in the front end scope. */ public function testCollectInFrontendScope() { $collector = new ContaoDataCollector($this->mockContainerWithContaoScopes(ContaoCoreBundle::SCOPE_FRONTEND), []); $layout = new \stdClass(); $layout->name = 'Default'; $layout->id = 2; $layout->template = 'fe_page'; global $objPage; $objPage = $this->getMockBuilder('Contao\\PageModel')->setMethods(['getRelated'])->disableOriginalConstructor()->getMock(); $objPage->expects($this->any())->method('getRelated')->willReturn($layout); $collector->collect(new Request(), new Response()); $this->assertEquals(['version' => '', 'framework' => false, 'models' => 0, 'frontend' => true, 'preview' => false, 'layout' => 'Default (ID 2)', 'template' => 'fe_page'], $collector->getSummary()); }
/** * Tests that an empty array is returned if $this->data is not an array. */ public function testWithNonArrayData() { $collector = new ContaoDataCollector([]); $collector->unserialize('N;'); $this->assertEquals([], $collector->getAdditionalData()); }