Пример #1
0
 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'));
 }
Пример #2
0
 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);
 }
Пример #3
0
 public function testGetFileContent()
 {
     $anyLine = 5;
     $noReadableFile = MockTest::mockFile('file.php', 0644, "Error");
     $this->assertNotEmpty($this->_fileContent->getFileContent($noReadableFile, $anyLine));
 }
Пример #4
0
 public function testReadFromYaml()
 {
     $yamlFile = MockTest::mockFile('anyYamlFile.yml', 0644, 'any: content');
     $this->assertEquals(['any' => 'content'], $this->yaml->parse($yamlFile));
 }
Пример #5
0
 /**
  * @expectedException \Ignaszak\Router\RouterException
  */
 public function testUnableToSaveTmpRoute()
 {
     $file = MockTest::mockFile('file.php', 0444);
     MockTest::callMockMethod($this->cache, 'saveTmpRoute', [$file, []]);
 }
Пример #6
0
 public function testGetChecksum()
 {
     $this->yaml->add(MockTest::mockFile('route.yml'));
     $this->assertEquals(md5(time()), $this->yaml->getChecksum());
 }
Пример #7
0
 public function testIsNotWritable()
 {
     $this->_check->add(MockTest::mockFile('anyFileOrFolder', 0444));
     $this->assertFalse($this->_check->isWritable());
 }
Пример #8
0
 public function testUnknownType()
 {
     $f = fopen(MockTest::mockFile('anyFile'), 'r');
     fclose($f);
     $this->assertEquals('unknown type', Variable::formatVariableType($f));
 }
Пример #9
0
 /**
  * @expectedException \Ignaszak\Registry\RegistryException
  */
 public function testCantCreateTmpFolder()
 {
     Conf::setTmpPath(MockTest::mockFile('tmpPath', 00));
     $stub = $this->getMock('AnyClass');
     $this->fileRegistry->set('anyName', $stub);
 }