public function testCreateUserAndProject() { $projectId = substr(STORAGE_API_TOKEN, 0, strpos(STORAGE_API_TOKEN, '-')); $writerId = 'test' . uniqid(); $this->client->createWriter($writerId); $email = $projectId . '-test-functional-' . uniqid() . '@test.com'; $result = $this->client->createUser($writerId, $email, uniqid(), 'functional', 'test user'); $this->assertArrayHasKey('uid', $result); $result = $this->client->createProject($writerId, '[Test] functional ' . uniqid()); $this->assertArrayHasKey('pid', $result); $pid = $result['pid']; $result = $this->client->addUserToProject($writerId, $pid, $email); $this->assertArrayHasKey('status', $result); $this->assertEquals('success', $result['status']); $result = $this->client->getUsers($writerId); $this->assertCount(2, $result); $userFound = false; foreach ($result as $r) { $this->assertArrayHasKey('email', $r); if ($r['email'] == $email) { $userFound = true; } } $this->assertTrue($userFound); $result = $this->client->getProjects($writerId); $this->assertCount(2, $result); $projectFound = false; foreach ($result as $r) { $this->assertArrayHasKey('pid', $r); if ($r['pid'] == $pid) { $projectFound = true; } } $this->assertTrue($projectFound); $result = $this->client->getProjectUsers($writerId, $pid); $this->assertCount(3, $result); $result = $this->client->getSsoLink($writerId, $pid, $email); $this->assertNotEmpty($result, "Result of getSsoLink request should contain link"); }