| @@ 11-26 (lines=16) @@ | ||
| 8 | { |
|
| 9 | use AbstractAppTest; |
|
| 10 | ||
| 11 | public function testGetUser() { |
|
| 12 | $schema = __DIR__.'/../../../../api/schemas/userInfo.json'; |
|
| 13 | ||
| 14 | $client = $this->createClient(); |
|
| 15 | $client = $this->logIn($client); |
|
| 16 | ||
| 17 | $crawler = $client->request('GET', '/api/v1/user/1'); |
|
| 18 | $response = $client->getResponse(); |
|
| 19 | ||
| 20 | //print_r($response); |
|
| 21 | $data = $client->getResponse()->getContent(); |
|
| 22 | $validator = $this->askValidation($data, $schema); |
|
| 23 | ||
| 24 | $assert = $this->evalValidation($validator); |
|
| 25 | $this->assertTrue($assert); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testPostBadge() { |
|
| 29 | $client = $this->createClient(); |
|
| @@ 50-68 (lines=19) @@ | ||
| 47 | $this->assertEquals(200, $response->getStatusCode()); |
|
| 48 | return $badge_id; |
|
| 49 | } |
|
| 50 | public function testGetBadge() { |
|
| 51 | $schema = __DIR__.'/../../../../api/schemas/badgeUser.json'; |
|
| 52 | ||
| 53 | $badge_id = $this->testPostBadge(); |
|
| 54 | $client = $this->createClient(); |
|
| 55 | $client = $this->logIn($client); |
|
| 56 | ||
| 57 | $crawler = $client->request('GET', '/api/v1/user/1/badge/'.$badge_id); |
|
| 58 | $response = $client->getResponse(); |
|
| 59 | ||
| 60 | //print_r($response); |
|
| 61 | $data = $client->getResponse()->getContent(); |
|
| 62 | ||
| 63 | //print_r($data); |
|
| 64 | $validator = $this->askValidation($data, $schema); |
|
| 65 | ||
| 66 | $assert = $this->evalValidation($validator); |
|
| 67 | $this->assertTrue($assert); |
|
| 68 | } |
|
| 69 | ||
| 70 | public function testDeleteBadge() { |
|
| 71 | $client = $this->createClient(); |
|
| @@ 108-123 (lines=16) @@ | ||
| 105 | return $badge_id; |
|
| 106 | } |
|
| 107 | ||
| 108 | public function testGetUserTicket() { |
|
| 109 | $schema = __DIR__.'/../../../../api/schemas/ticketList.json'; |
|
| 110 | ||
| 111 | $client = $this->createClient(); |
|
| 112 | $client = $this->logIn($client); |
|
| 113 | ||
| 114 | $crawler = $client->request('GET', '/api/v1/user/1/ticket'); |
|
| 115 | $response = $client->getResponse(); |
|
| 116 | ||
| 117 | //print_r($response); |
|
| 118 | $data = $client->getResponse()->getContent(); |
|
| 119 | $validator = $this->askValidation($data, $schema); |
|
| 120 | ||
| 121 | $assert = $this->evalValidation($validator); |
|
| 122 | $this->assertTrue($assert); |
|
| 123 | } |
|
| 124 | } |
|
| 125 | ||
| @@ 12-29 (lines=18) @@ | ||
| 9 | use AbstractAppTest; |
|
| 10 | ||
| 11 | /*Verifico che il Workspace si possa scaricare correttamente*/ |
|
| 12 | public function testGetWorkSpace() { |
|
| 13 | $schema = __DIR__.'/../../../../api/schemas/workspace.json'; |
|
| 14 | ||
| 15 | $client = $this->createClient(); |
|
| 16 | $client = $this->logIn($client); |
|
| 17 | ||
| 18 | $id = $this->testPostWorkspace(); |
|
| 19 | ||
| 20 | $crawler = $client->request('GET', '/api/v1/workspace/'.$id); |
|
| 21 | $response = $client->getResponse(); |
|
| 22 | $data = $client->getResponse()->getContent(); |
|
| 23 | $validator = $this->askValidation($data, $schema); |
|
| 24 | ||
| 25 | $assert = $this->evalValidation($validator); |
|
| 26 | $this->assertTrue($assert); |
|
| 27 | ||
| 28 | return $data; |
|
| 29 | } |
|
| 30 | /*Verifico che l'elenco dei workspace si possa scaricare correttamente*/ |
|
| 31 | ||
| 32 | /** |
|
| @@ 35-50 (lines=16) @@ | ||
| 32 | /** |
|
| 33 | * @return string |
|
| 34 | */ |
|
| 35 | public function testGetWorkspaceList(){ |
|
| 36 | $schema = __DIR__.'/../../../../api/schemas/workspaceList.json'; |
|
| 37 | ||
| 38 | $client = $this->createClient(); |
|
| 39 | $client = $this->logIn($client); |
|
| 40 | ||
| 41 | $crawler = $client->request('GET', '/api/v1/workspace/'); |
|
| 42 | $response = $client->getResponse(); |
|
| 43 | ||
| 44 | $data = $client->getResponse()->getContent(); |
|
| 45 | $validator = $this->askValidation($data, $schema); |
|
| 46 | ||
| 47 | $assert = $this->evalValidation($validator); |
|
| 48 | $this->assertTrue($assert); |
|
| 49 | return $data; |
|
| 50 | } |
|
| 51 | /*verifico che si possa condividere il workspace */ |
|
| 52 | public function testGetWorkspaceShare() { |
|
| 53 | $schema = __DIR__.'/../../../../api/schemas/workspaceShare.json'; |
|
| @@ 52-65 (lines=14) @@ | ||
| 49 | return $data; |
|
| 50 | } |
|
| 51 | /*verifico che si possa condividere il workspace */ |
|
| 52 | public function testGetWorkspaceShare() { |
|
| 53 | $schema = __DIR__.'/../../../../api/schemas/workspaceShare.json'; |
|
| 54 | ||
| 55 | $client = $this->createClient(); |
|
| 56 | $client = $this->logIn($client); |
|
| 57 | ||
| 58 | $crawler = $client->request('GET', '/api/v1/workspace/1/share'); |
|
| 59 | $response = $client->getResponse(); |
|
| 60 | ||
| 61 | //print_r($response); |
|
| 62 | $data = $client->getResponse()->getContent(); |
|
| 63 | $validator = $this->askValidation($data, $schema); |
|
| 64 | ||
| 65 | $assert = $this->evalValidation($validator); |
|
| 66 | $this->assertTrue($assert); |
|
| 67 | } |
|
| 68 | ||