diff --git a/README.md b/README.md index 8eeedb37c..87aede871 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,21 @@ The dev environment provides a MySQL server, mail server, s3 server, and should Additionally, Xdebug is enabled, but you will have to modify your IDE key in the ``.dev/xdebug.ini`` file(or alternatively, on your IDE). You also need to have port 9003 temporarily open on your firewall so you can utilize it effectively. This is because connections from docker to the host will count as external inbound connections

+ +### Run Tests + +Static Analysis `make phpstan`
+Code Style `make test-code-style` (to fix code style automatically use `make fix-code-style`)
+Unit Tests `make unit-test`
+Acceptance Tests `make acceptance-test`
(requires docker) + +You can test individual acceptance test groups directly using:
+For api:
+`docker compose --file .dev/docker-compose.yaml --file .dev/docker-compose.tests.yaml exec leantime-dev php vendor/bin/codecept run -g api --steps`
+For timesheets:
+`docker compose --file .dev/docker-compose.yaml --file .dev/docker-compose.tests.yaml exec leantime-dev php vendor/bin/codecept run -g timesheet --steps`
+ + ### 🏗 Update ### #### Manual diff --git a/tests/Acceptance/ApiCest.php b/tests/Acceptance/API/ApiCest.php similarity index 99% rename from tests/Acceptance/ApiCest.php rename to tests/Acceptance/API/ApiCest.php index cbfa9e58f..9518e8219 100644 --- a/tests/Acceptance/ApiCest.php +++ b/tests/Acceptance/API/ApiCest.php @@ -1,6 +1,6 @@ 'leantime.rpc.Comments.pollComments', 'params' => ['projectId' => 1], 'id' => 1, - 'jsonrpc' => '2.0' + 'jsonrpc' => '2.0', ]; $this->template->expects($this->once()) ->method('displayJson') - ->willReturnCallback(function($response) { + ->willReturnCallback(function ($response) { $this->assertArrayHasKey('jsonrpc', $response); $this->assertEquals('2.0', $response['jsonrpc']); + return response()->json($response); }); @@ -45,14 +47,15 @@ public function testInvalidMethodString() 'method' => 'invalid.method.string', 'params' => ['projectId' => 1], 'id' => 1, - 'jsonrpc' => '2.0' + 'jsonrpc' => '2.0', ]; $this->template->expects($this->once()) ->method('displayJson') - ->willReturnCallback(function($response) { + ->willReturnCallback(function ($response) { $this->assertArrayHasKey('error', $response); $this->assertEquals(-32602, $response['error']['code']); + return response()->json($response); }); @@ -64,14 +67,15 @@ public function testMissingJsonRpcVersion() $params = [ 'method' => 'leantime.rpc.Comments.pollComments', 'params' => ['projectId' => 1], - 'id' => 1 + 'id' => 1, ]; $this->template->expects($this->once()) ->method('displayJson') - ->willReturnCallback(function($response) { + ->willReturnCallback(function ($response) { $this->assertArrayHasKey('error', $response); $this->assertEquals(-32600, $response['error']['code']); + return response()->json($response); }); @@ -85,21 +89,22 @@ public function testBatchRequest() 'method' => 'leantime.rpc.Comments.pollComments', 'params' => ['projectId' => 1], 'id' => 1, - 'jsonrpc' => '2.0' + 'jsonrpc' => '2.0', ], [ 'method' => 'leantime.rpc.Comments.pollComments', 'params' => ['projectId' => 2], 'id' => 2, - 'jsonrpc' => '2.0' - ] + 'jsonrpc' => '2.0', + ], ]; $this->template->expects($this->once()) ->method('displayJson') - ->willReturnCallback(function($response) { + ->willReturnCallback(function ($response) { $this->assertIsArray($response); $this->assertCount(2, $response); + return response()->json($response); });