Exemple #1
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage View cannot render `null.php` because the layout does not exist
  */
 public function testRenderLayoutNotFoundException()
 {
     $this->app->config('templates.path', './tests/templates');
     $this->app->view()->setLayout('null.php');
     $this->app->view()->setViewVar('view');
     $this->app->render('view.php');
 }
Exemple #2
0
 public function testMapRouteControllerWithoutContainer()
 {
     $route = $this->app->get('/bar/xyz', '\Nius\Core\Controller:index');
     ob_start();
     $this->app->run();
     $text = ob_get_clean();
     $this->assertEquals('Hello, world!', $text);
     $this->assertInstanceOf('\Slim\Route', $route);
 }
Exemple #3
0
    public function testWrite()
    {
        //Test single class
        $file = './logs/debug.log';
        $message = $this->log->write('Test message', 'TEST');
        $this->assertFileExists($file);
        $fileContent = file_get_contents($file);
        $this->assertEquals($message, str_replace(array("\n", "\r", "\r\n"), '', $fileContent));
        $this->rmdir('./logs');

        //Test as di part
        $file = './log/debug.log';
        $message = $this->app->getLog()->debug('Test message');
        $fileContent = file_get_contents($file);
        $this->assertEquals($message, str_replace(array("\n", "\r", "\r\n"), '', $fileContent));
        $this->rmdir('./log');
    }