/
FlatFileContentControllerTest.php
57 lines (42 loc) · 1.23 KB
/
FlatFileContentControllerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace Anax\Controller;
use Anax\DI\DIFactoryConfig;
use PHPUnit\Framework\TestCase;
/**
* Test the FlatFileContentController.
*/
class FlatFileContentControllerTest extends TestCase
{
// Create the di container.
protected $di;
protected $controller;
/**
* Prepare before each test.
*/
protected function setUp()
{
global $di;
// Setup di
$this->di = new DIFactoryConfig();
$this->di->loadServices(ANAX_INSTALL_PATH . "/config/di");
// Use a different cache dir for unit test
$this->di->get("cache")->setPath(ANAX_INSTALL_PATH . "/test/cache");
// View helpers uses the global $di so it needs its value
$di = $this->di;
// Setup the controller
$this->controller = new FlatFileContentController();
$this->controller->setDI($this->di);
//$this->controller->initialize();
}
/**
* Test the route "index".
*/
public function testIndexAction()
{
$res = $this->controller->catchAll();
$this->assertInstanceOf("\Anax\Response\Response", $res);
$body = $res->getBody();
$exp = "| ramverk1</title>";
$this->assertContains($exp, $body);
}
}