/** * @test */ public function it_throws_a_422_when_validation_fails_while_updating_an_attendee_counselor_assignment() { //arrange $this->make('App\\Attendee'); $attendee = App\Attendee::first(); //act $response = $this->getJson('attendees/' . $attendee->id . '/counselor', 'PUT', []); //assert $this->assertResponseStatus(422); $this->assertObjectHasAttributes($response, 'error'); $this->assertObjectHasAttributes($response->error, 'message'); $this->assertContains('Parameters failed validation for an attendee.', $response->error->message); }
/** * @test */ public function it_deletes_an_enrollment() { //arrange $attendeeTest = new AttendeesTest(); $programTest = new ProgramsTest(); $this->times(1)->make('App\\Attendee', $attendeeTest->getStub()); $this->times(1)->make('App\\Program', $programTest->getStub()); $program = App\Program::first(); $attendee = App\Attendee::first(); App\Enrollment::create(['attendee_id' => $attendee->id, 'program_id' => $program->id, 'start_date' => $this->faker->dateTimeBetween($startDate = '-12 months')]); $enrollment = App\Enrollment::first(); //act $response = $this->getJson('enrollments/' . $enrollment->id, 'DELETE'); $enrollment = App\Enrollment::onlyTrashed()->find($enrollment->id); //assert $this->assertResponseStatus(200); $this->assertObjectHasAttributes($response, 'message'); $this->assertContains('The enrollment has been deleted.', $response->message); $this->assertEquals($enrollment->trashed(), True); }