loginAs($this->user); $this->get('/api/people/' . $this->user->getPerson()->getId()); $this->validateCollectionSchema(Person::class); $this->assertJsonContains([ '@context' => '/api/contexts/Person', '@id' => '/api/people/' . $this->user->getPerson()->getId(), '@type' => 'Person', 'username' => 'username' ]); } public function testPersonGetHasNoRole(): void { // User has not the required role $this->user->setRoles([]); $this->user->save(); $this->loginAs($this->user); $this->get('/api/people/' . $this->user->getPerson()->getId()); $this->validateCollectionSchema(Person::class, 403); $this->assertJsonContains([ "hydra:description" => "Access Denied." ]); } public function testPersonGetCollection(): void { $this->loginAs($this->user); $this->get('/api/peoples'); $this->assertResponseStatusCodeSame(404); } public function testPersonPut(): void { $this->loginAs($this->user); $this->put('/api/people/' . $this->user->getPerson()->getId(), []); // Expects : 405 Method Not Allowed $this->assertResponseStatusCodeSame(405); } public function testPersonPost(): void { $this->loginAs($this->user); $this->post('/api/people/' . $this->user->getPerson()->getId(), []); // Expects : 405 Method Not Allowed $this->assertResponseStatusCodeSame(405); } public function testPersonDelete(): void { $this->loginAs($this->user); $this->delete('/api/people/' . $this->user->getPerson()->getId()); // Expects : 405 Method Not Allowed $this->assertResponseStatusCodeSame(405); } }