logger->info("\033[1;34mStarting test... get education Timings collection as an admin\033[0m"); $this->loginAs($this->user); $this->get('/api/education_timings'); $this->assertResponseStatusCodeSame(200); $this->assertJsonContains([ 'hydra:member' => [ [ 'organization' => '/api/organizations/1', 'timing' => 45, ], ], ]); $this->logger->info("\033[1;32mTest 'get education Timings collection as an admin' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... create an education timings as an admin\033[0m"); $this->loginAs($this->user); $this->post('/api/education_timings', [ 'timing' => 60, ]); $this->assertResponseStatusCodeSame(201); $this->assertJsonContains([ '@context' => '/api/contexts/EducationTiming', '@id' => '/api/education_timings/3', '@type' => 'EducationTiming', 'id' => 3, 'timing' => 60, 'organization' => '/api/organizations/1', 'educationStudents' => [], 'educationCurriculums' => [], ]); $this->logger->info("\033[1;32mTest 'get education Timings collection as an admin' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... change an education timing as an admin\033[0m"); $this->loginAs($this->user); $this->put('/api/education_timings/1', [ 'timing' => 60, ]); $this->logger->info("\033[1;32mTest 'change an education timing as an admin' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... delete an education timing as an admin\033[0m"); $this->loginAs($this->user); $this->delete('/api/education_timings/1'); $this->logger->info("\033[1;32mTest 'delete an education timing as an admin' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... change an education timing as an non admin\033[0m"); $this->loginAsStudent($this->user); $this->put('/api/education_timings/1', [ 'timing' => 60, ]); $this->assertResponseStatusCodeSame(404); $this->logger->info("\033[1;32mTest 'change an education timing as an admin' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... delete an education timing as an non admin\033[0m"); $this->loginAsStudent($this->user); $this->delete('/api/education_timings/1'); $this->assertResponseStatusCodeSame(404); $this->logger->info("\033[1;32mTest 'delete an education timing as an non-admin' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... intru of organization try to get an education timings\033[0m"); $this->loginAsintruOfRoot($this->user); $this->get('/api/education_timings/1'); $this->assertResponseStatusCodeSame(404); $this->logger->info("\033[1;32mTest 'intru of organization try to get an education timings' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... intru of organization try to put an education timings\033[0m"); $this->loginAsintruOfRoot($this->user); $this->put('/api/education_timings/1', [ 'timing' => 60, 'organization' => '/api/organizations/1', ]); $this->assertResponseStatusCodeSame(404); $this->logger->info("\033[1;32mTest 'intru of organization try to put an education timings' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... intru of organization try to delete an education timings\033[0m"); $this->loginAsintruOfRoot($this->user); $this->delete('/api/education_timings/1'); $this->assertResponseStatusCodeSame(404); $this->logger->info("\033[1;32mTest 'intru of organization try to delete an education timings' succeed\033[0m"); $this->logger->info("\033[1;34mStarting test... intru of organization try to post an education timings\033[0m"); $this->loginAsintruOfRoot($this->user); $this->post('/api/education_timings', [ 'timing' => 45, 'organization' => '/api/organizations/1', ]); $this->assertResponseStatusCodeSame(400); $this->logger->info("\033[1;32mTest 'intru of organization try to post an education timings' succeed\033[0m"); } }