Domain\Employee\Http\EmployeeControllerTest::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();
        $employee = ['name' => 'Funcionário x', 'sex' => 'male', 'user' => ['username' => $username, 'password' => $username, 'email' => $username . '@gmail.com']];
        $this->post('api/v1/employee/', $employee);
        $this->seeStatusCode(200);
        $this->seeJson(['name' => 'Funcionário x', 'sex' => 'male', 'username' => $username]);
        $employee = $this->response->original;
        $this->assertInstanceOf(Employee::class, $employee);
        $this->assertInstanceOf(User::class, $employee->user);
        $this->assertEquals($employee->user->owner_id, $employee->id);
        $this->assertEquals($employee->user->owner_type, get_class($employee));
        $this->seeInDatabase('employees', ['id' => $employee->id]);
        $this->seeInDatabase('users', ['id' => $employee->user->id]);
    }