blob: 3ca163d8bf819b3595450dbb88f82526ba2c0df7 (
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
|
<?php
use JsonApi\Routes\InstituteMemberships\ByUserIndex;
class InstitutesByUserTest extends \Codeception\Test\Unit
{
/**
* @var \UnitTester
*/
protected $tester;
protected function _before()
{
\DBManager::getInstance()->setConnection('studip', $this->getModule('\\Helper\\StudipDb')->dbh);
}
protected function _after()
{
}
// tests
public function testShouldShowMemberships()
{
$credentials = $this->tester->getCredentialsForTestDozent();
$app = $this->tester->createApp($credentials, 'get', '/users/{id}/institute-memberships', ByUserIndex::class);
$response = $this->tester->sendMockRequest(
$app,
$this->tester->createRequestBuilder($credentials)
->setUri('/users/'.$credentials['id'].'/institute-memberships')
->fetch()
->getRequest()
);
$this->tester->assertTrue($response->isSuccessfulDocument([200]));
$document = $response->document();
$this->tester->assertTrue($document->isResourceCollectionDocument());
$resources = $document->primaryResources();
$this->tester->assertCount(1, $resources);
}
}
|