logger->info("\033[1;34mStarting test... Retrieve the list of all residence area for an admin user\033[0m"); $this->loginAs($this->user); $this->get('/api/residence_areas'); $this->assertResponseStatusCodeSame(200); $this->logger->info("\033[1;32mTest 'testGetResidenceAreaCollection' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... try to put a new label on R-A as an admin user \033[0m"); $this->loginAs($this->user); $this->put('/api/residence_areas/1', [ 'label' => 'tata', ]); $this->assertResponseStatusCodeSame(200); $this->assertJsonContains([ '@context' => '/api/contexts/ResidenceArea', '@type' => 'ResidenceArea', 'label' => 'tata', 'billingSetting' => '/api/billing_settings/1', ]); $this->logger->info("\033[1;32mTest 'testPutResidenceArea' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... Add a residence area as an admin\033[0m"); $this->loginAs($this->user); $this->post('/api/residence_areas', [ 'label' => 'toto', 'billingSetting' => '/api/billing_settings/1', ]); $this->assertResponseStatusCodeSame(201); $this->assertJsonContains([ '@context' => '/api/contexts/ResidenceArea', '@type' => 'ResidenceArea', 'label' => 'toto', ]); $this->logger->info("\033[1;32mTest 'testPostResidenceArea' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... delete a residence area as an admin\033[0m"); $this->loginAs($this->user); $this->delete('/api/residence_areas/1'); $this->assertResponseStatusCodeSame(204); $this->logger->info("\033[1;32mTest 'testDeleteResidenceArea' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... get all residence area as an non-admin\033[0m"); $this->loginAsStudent($this->user); $this->get('/api/residence_areas'); $this->assertResponseStatusCodeSame(403); $this->logger->info("\033[1;32mTest 'testGetResidenceCollectionWithBadRoles' succeed\033[0m"); } // public function testPutResidenceArea() // { // $this->logger->info("\033[1;34mStarting test... try to put a new label on R-A as an admin user \033[0m"); // $this->loginAs($this->user); // $this->put('/api/residence_areas/1', [ // 'label' => 'tata', // ]); // $this->assertResponseStatusCodeSame(200); // $this->assertJsonContains([ // '@context' => '/api/contexts/ResidenceArea', // '@type' => 'ResidenceArea', // 'label' => 'tata', // 'billingSetting' => '/api/billing_settings/1' // ]); // $this->logger->info("\033[1;32mTest 'testPutResidenceArea' succeed\033[0m"); // } // public function testPostResidenceArea() // { // $this->logger->info("\033[1;34mStarting test... Add a residence area as an admin\033[0m"); // $this->loginAs($this->user); // $this->assertResponseIsSuccessful(); // $this->post('/api/residence_areas', [ // 'label' => 'toto', // 'billingSetting' => '/api/billing_settings/1' // ]); // $this->assertResponseStatusCodeSame(201); // $this->assertJsonContains([ // '@context' => '/api/contexts/ResidenceArea', // '@type' => 'ResidenceArea', // 'label' => 'toto' // ]); // $this->logger->info("\033[1;32mTest 'testPostResidenceArea' succeed\033[0m"); // } // public function testDeleteResidenceArea() // { // $this->logger->info("\033[1;34mStarting test... delete a residence area as an admin\033[0m"); // $this->loginAs($this->user); // $this->delete('/api/residence_areas/1'); // $this->assertResponseStatusCodeSame(204); // $this->logger->info("\033[1;32mTest 'testDeleteResidenceArea' succeed\033[0m"); // } // /// change adminAccess to false and retest // public function testGetResidenceCollectionWithBadRoles() // { // $this->logger->info("\033[1;34mStarting test... get all residence area as an non-admin\033[0m"); // $this->loginAsStudent($this->user); // $this->get('/api/residence_areas'); // $this->assertResponseStatusCodeSame(403); // $this->logger->info("\033[1;32mTest 'testGetResidenceCollectionWithBadRoles' succeed\033[0m"); // } }