public function testLoadHttp() { MockTest::inject($this->_load, 'conf', ['conf' => ['tmp' => ['router' => MockTest::mockFileSystem([''])]]]); MockTest::inject($this->_load, 'routerYaml', MockTest::mockFile('router.yml')); $this->_load->loadHttp(); $this->assertInstanceOf('App\\Resource\\Http', \PHPUnit_Framework_Assert::readAttribute($this->_load, 'http')); }
public function testLoadFile() { MockTest::inject($this->display, 'baseDir'); // Clear baseDir for mock file $file = MockTest::mockFile('AnyThemeFile.php', 0777, '<?php new \\Test\\TestLoadCount; ?>'); MockTest::callMockMethod($this->display, 'load', array($file)); $this->assertEquals(1, TestLoadCount::$count); }
public function testGetFileContent() { $anyLine = 5; $noReadableFile = MockTest::mockFile('file.php', 0644, "Error"); $this->assertNotEmpty($this->_fileContent->getFileContent($noReadableFile, $anyLine)); }
public function testReadFromYaml() { $yamlFile = MockTest::mockFile('anyYamlFile.yml', 0644, 'any: content'); $this->assertEquals(['any' => 'content'], $this->yaml->parse($yamlFile)); }
/** * @expectedException \Ignaszak\Router\RouterException */ public function testUnableToSaveTmpRoute() { $file = MockTest::mockFile('file.php', 0444); MockTest::callMockMethod($this->cache, 'saveTmpRoute', [$file, []]); }
public function testGetChecksum() { $this->yaml->add(MockTest::mockFile('route.yml')); $this->assertEquals(md5(time()), $this->yaml->getChecksum()); }
public function testIsNotWritable() { $this->_check->add(MockTest::mockFile('anyFileOrFolder', 0444)); $this->assertFalse($this->_check->isWritable()); }
public function testUnknownType() { $f = fopen(MockTest::mockFile('anyFile'), 'r'); fclose($f); $this->assertEquals('unknown type', Variable::formatVariableType($f)); }
/** * @expectedException \Ignaszak\Registry\RegistryException */ public function testCantCreateTmpFolder() { Conf::setTmpPath(MockTest::mockFile('tmpPath', 00)); $stub = $this->getMock('AnyClass'); $this->fileRegistry->set('anyName', $stub); }