assertStatus($status); if ($type) { $this->assertJson(['error_type' => $type]); } $structure = ['message', 'error_type']; if ($hasInfo) { $structure[] = 'info'; } else { PHPUnit::assertArrayNotHasKey('info', $this->decodeResponseJson()); } $this->assertJsonStructure($structure); return $this; } public function assertUnauthorized( string $type = AuthorizationException::ERROR_TYPE_UNAUTHORIZED, bool $hasInfo = false ): TestResponse { return $this->assertError(self::HTTP_UNAUTHORIZED, $type, $hasInfo); } public function assertForbidden( string $type = AuthorizationException::ERROR_TYPE_FORBIDDEN, bool $hasInfo = false ): TestResponse { return $this->assertError(self::HTTP_FORBIDDEN, $type, $hasInfo); } public function assertValidationError(string $type = 'validation', bool $hasInfo = true): TestResponse { return $this->assertError(self::HTTP_BAD_REQUEST, $type, $hasInfo); } public function assertNotFound(string $type = 'query.item_not_found', bool $hasInfo = false): TestResponse { return $this->assertError(self::HTTP_NOT_FOUND, $type, $hasInfo); } public function assertConflict(string $type = 'query.item_already_exists', bool $hasInfo = false): TestResponse { return $this->assertError(self::HTTP_CONFLICT, $type, $hasInfo); } public function assertSuccess(int $status = self::HTTP_OK): TestResponse { $this->assertStatus($status); return $this; } public static function assertEquals(...$params): void { PHPUnit::assertEquals(...$params); } public static function assertNotEquals(...$params): void { PHPUnit::assertNotEquals(...$params); } }