1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ylvan\Controller; |
4
|
|
|
|
5
|
|
|
use Anax\DI\DIFactoryConfig; |
|
|
|
|
6
|
|
|
use PHPUnit\Framework\TestCase; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Test the SampleController. |
10
|
|
|
*/ |
11
|
|
|
class GeotagControllerTest extends TestCase |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
// Create the di container. |
16
|
|
|
protected $di; |
17
|
|
|
protected $controller; |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Prepare before each test. |
23
|
|
|
*/ |
24
|
|
|
protected function setUp() |
25
|
|
|
{ |
26
|
|
|
global $di; |
27
|
|
|
|
28
|
|
|
// Setup di |
29
|
|
|
$this->di = new DIFactoryConfig(); |
30
|
|
|
$this->di->loadServices(ANAX_INSTALL_PATH . "/config/di"); |
31
|
|
|
|
32
|
|
|
// Use a different cache dir for unit test |
33
|
|
|
$this->di->get("cache")->setPath(ANAX_INSTALL_PATH . "/test/cache"); |
34
|
|
|
|
35
|
|
|
// View helpers uses the global $di so it needs its value |
36
|
|
|
$di = $this->di; |
37
|
|
|
|
38
|
|
|
// Setup the controller |
39
|
|
|
$this->controller = new GeotagController(); |
40
|
|
|
$this->controller->setDI($this->di); |
41
|
|
|
//$this->controller->initialize(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Test the route "index". |
47
|
|
|
*/ |
48
|
|
|
public function testIndexActionType() |
49
|
|
|
{ |
50
|
|
|
$res = $this->controller->indexAction(); |
51
|
|
|
// $this->assertInstanceOf("\Anax\Response\Response", $res); |
52
|
|
|
|
53
|
|
|
// $body = $res->getBody(); |
54
|
|
|
// $exp = "Validera IP</title>"; |
55
|
|
|
$this->assertIsObject($res); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Test the route "index". |
60
|
|
|
*/ |
61
|
|
|
public function testIndexActioncontent() |
62
|
|
|
{ |
63
|
|
|
$res = $this->controller->indexAction(); |
64
|
|
|
// $this->assertInstanceOf("\Anax\Response\Response", $res); |
65
|
|
|
|
66
|
|
|
// $body = $res->getBody(); |
67
|
|
|
// $exp = "Validera IP</title>"; |
68
|
|
|
$this->assertNotNull($res); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths