/** * @test */ public function getPartialSourceReturnsContentOfDefaultPartialFileIfNoPartialExistsForTheSpecifiedFormat() { $partialRootPath = __DIR__ . '/Fixtures'; $this->view->setPartialRootPath($partialRootPath); $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('foo')); $expectedResult = file_get_contents($partialRootPath . '/LayoutFixture'); $actualResult = $this->view->_call('getPartialSource', 'LayoutFixture'); $this->assertEquals($expectedResult, $actualResult); }
/** * @test */ public function getLayoutPathAndFilenameWalksStringKeysInReversedOrder() { $this->view->setLayoutRootPaths(array('default' => 'some/Default/Directory', 'specific' => 'specific/Layout', 'verySpecific' => 'evenMore/Specific/Layout')); $this->mockRequest->expects($this->any())->method('getFormat')->will($this->returnValue('html')); $this->view->expects($this->at(0))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Layout/Default.html')->will($this->returnValue(false)); $this->view->expects($this->at(1))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Layout/Default')->will($this->returnValue(false)); $this->view->expects($this->at(2))->method('testFileExistence')->with(PATH_site . 'specific/Layout/Default.html')->will($this->returnValue(false)); $this->view->expects($this->at(3))->method('testFileExistence')->with(PATH_site . 'specific/Layout/Default')->will($this->returnValue(false)); $this->view->expects($this->at(4))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Default.html')->will($this->returnValue(false)); $this->view->expects($this->at(5))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Default')->will($this->returnValue(true)); $this->assertEquals(PATH_site . 'some/Default/Directory/Default', $this->view->_call('getLayoutPathAndFilename')); }