8 Commits
21 changed files with 78649 additions and 20 deletions
+9 -13
View File
@@ -31,7 +31,6 @@ class ErrorHandlerTest extends Unit
protected function _before(): void protected function _before(): void
{ {
parent::_before(); parent::_before();
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->app = $this->makeEmpty(App::class, [ $this->app = $this->makeEmpty(App::class, [
'getResponseFactory' => $this->makeEmpty(ResponseFactoryInterface::class, [ 'getResponseFactory' => $this->makeEmpty(ResponseFactoryInterface::class, [
'createResponse' => $this->makeEmpty(ResponseInterface::class, [ 'createResponse' => $this->makeEmpty(ResponseInterface::class, [
@@ -44,15 +43,18 @@ class ErrorHandlerTest extends Unit
]), ]),
]), ]),
]); ]);
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->request = $this->makeEmpty(ServerRequestInterface::class, [ $this->request = $this->makeEmpty(ServerRequestInterface::class, [
'getAttribute' => function ($name) { 'getAttribute' => function ($name) {
return match ($name) { /** @noinspection PhpSwitchCanBeReplacedWithMatchExpressionInspection */
RouteContext::ROUTE_PARSER => $this->makeEmpty(RouteParserInterface::class), switch ($name) {
RouteContext::ROUTING_RESULTS => $this->makeEmpty(RoutingResults::class), case RouteContext::ROUTE_PARSER:
default => null, return $this->makeEmpty(RouteParserInterface::class);
}; case RouteContext::ROUTING_RESULTS:
return $this->makeEmpty(RoutingResults::class);
default:
return null;
} }
},
]); ]);
} }
@@ -61,13 +63,11 @@ class ErrorHandlerTest extends Unit
*/ */
public function testUseWithLogger(): void public function testUseWithLogger(): void
{ {
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->exception = $this->make(Exception::class, [ $this->exception = $this->make(Exception::class, [
'message' => '', 'message' => '',
'code' => 400, 'code' => 400,
'file' => '/path(to/file', 'file' => '/path(to/file',
]); ]);
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->logger = $this->makeEmpty(LoggerInterface::class, [ $this->logger = $this->makeEmpty(LoggerInterface::class, [
'error' => Expected::once(), 'error' => Expected::once(),
]); ]);
@@ -81,14 +81,12 @@ class ErrorHandlerTest extends Unit
*/ */
public function testUseWithHttpException(): void public function testUseWithHttpException(): void
{ {
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->exception = $this->make(HttpException::class, [ $this->exception = $this->make(HttpException::class, [
'message' => '', 'message' => '',
'code' => 400, 'code' => 400,
'file' => '/path(to/file', 'file' => '/path(to/file',
'getTitle' => Expected::once('The Title'), 'getTitle' => Expected::once('The Title'),
]); ]);
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->logger = $this->makeEmpty(LoggerInterface::class, []); $this->logger = $this->makeEmpty(LoggerInterface::class, []);
$middleWare = new ErrorHandler($this->app); $middleWare = new ErrorHandler($this->app);
@@ -101,13 +99,11 @@ class ErrorHandlerTest extends Unit
*/ */
public function testUseWithGeneralException(): void public function testUseWithGeneralException(): void
{ {
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->exception = $this->make(Exception::class, [ $this->exception = $this->make(Exception::class, [
'message' => '', 'message' => '',
'code' => 400, 'code' => 400,
'file' => '/path(to/file', 'file' => '/path(to/file',
]); ]);
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
$this->logger = $this->makeEmpty(LoggerInterface::class, []); $this->logger = $this->makeEmpty(LoggerInterface::class, []);
$middleWare = new ErrorHandler($this->app); $middleWare = new ErrorHandler($this->app);
+6
View File
@@ -24,3 +24,9 @@ services:
volumes: volumes:
- ./api:/var/www - ./api:/var/www
- logs:/var/www/logs - logs:/var/www/logs
ui:
build: ./ui/
ports:
- 80:80
depends_on:
- api
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
install_api_dependence() {
cd api/ || exit 2
composer install
cd ..
}
build_ui() {
cd ui/ || exit 2
npm run build
cd ..
}
test_unit() {
pwd
cd api/ || exit 2
./vendor/bin/codecept run unit
cd ..
}
test_api() {
cd api/ || exit 2
./vendor/bin/codecept run api
cd ..
}
composer_run() {
docker-compose up -d
}
install_api_dependence && build_ui && test_unit && composer_run && test_api
+3
View File
@@ -0,0 +1,3 @@
FROM httpd:2.4
COPY ./public/ /usr/local/apache2/htdocs/
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.
Binary file not shown.