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