Domain\Student\Http\StudentControllerTest::test_store_by_post PHP Method

test_store_by_post() public method

public test_store_by_post ( )
    public function test_store_by_post()
    {
        $username = uniqid();
        $student = ['name' => 'Aluno x', 'sex' => 'male', 'responsible' => 'Responsável', 'phone_responsible' => '4199999999', 'postcode' => '12345678', 'street' => 'Rua x', 'number' => '1', 'district' => 'Bairro', 'city' => 'Cidade', 'state' => 'PR', 'phone' => '4133333333', 'cellphone' => '4199999999', 'monthly_payment' => 10, 'day_of_payment' => 15, 'installments' => 5, 'user' => ['username' => $username, 'password' => $username, 'email' => $username . '@gmail.com'], 'status' => true];
        $this->post('api/v1/student/', $student);
        $this->seeStatusCode(200);
        $this->seeJson(['name' => 'Aluno x', 'sex' => 'male', 'username' => $username]);
        $student = $this->response->original;
        $this->assertInstanceOf(Student::class, $student);
        $this->assertInstanceOf(User::class, $student->user);
        $this->assertEquals($student->user->owner_id, $student->id);
        $this->assertEquals($student->user->owner_type, get_class($student));
        $this->seeInDatabase('students', ['id' => $student->id]);
        $this->seeInDatabase('users', ['id' => $student->user->id]);
    }