blob: bf44755d7f84bbc8e1abc6af5568786aa70c00b8 (
plain)
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
|
<?php
use JsonApi\Routes\Studip\PropertiesIndex;
class StudipPropertiesIndexTest extends \Codeception\Test\Unit
{
/**
* @var \UnitTester
*/
protected $tester;
protected function _before()
{
if (!isset($GLOBALS['SOFTWARE_VERSION'])) {
$GLOBALS['SOFTWARE_VERSION'] = '';
}
\DBManager::getInstance()->setConnection('studip', $this->getModule('\\Helper\\StudipDb')->dbh);
}
protected function _after()
{
}
// tests
public function testGetStudipPropertiesIndex()
{
$app = $this->tester->createApp(null, 'get', '/studip/properties', PropertiesIndex::class);
$requestBuilder = $this->tester->createRequestBuilder(null);
$requestBuilder->setUri('/studip/properties')->fetch();
$response = $this->tester->sendMockRequest($app, $requestBuilder->getRequest());
$this->tester->assertTrue($response->isSuccessfulDocument([200]));
$document = $response->document();
$this->tester->assertTrue($document->isResourceCollectionDocument());
$ids = array_map(function ($property) { return $property->id(); }, $document->primaryResources());
$this->tester->assertContains('studip-version', $ids);
}
}
|