diff --git a/.github/workflows/laravel.yml b/.github/workflows/run-tests-with-coverage.yml similarity index 96% rename from .github/workflows/laravel.yml rename to .github/workflows/run-tests-with-coverage.yml index 3b175d4..47cc699 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/run-tests-with-coverage.yml @@ -1,4 +1,4 @@ -name: run-tests-with-coverage +name: Run tests with coverage on: push: diff --git a/Dockerfile b/Dockerfile index 0e5ff36..4be32fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM webdevops/php-nginx:7.3 +FROM webdevops/php-nginx-dev:7.3 + RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux" \ && chmod +x "/usr/local/bin/go-replace" \ && "/usr/local/bin/go-replace" --version diff --git a/docker-compose.yml b/docker-compose.yml index 74f4c52..b33a639 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,7 @@ version: '3' services: nginx: - build: - context: ./ - dockerfile: "Dockerfile" + build: . working_dir: /app ports: - 80:80 diff --git a/tests/RemoteDriverTest.php b/tests/RemoteDriverTest.php index 57b22b0..3d000d6 100755 --- a/tests/RemoteDriverTest.php +++ b/tests/RemoteDriverTest.php @@ -11,7 +11,7 @@ class RemoteDriverTest extends TestCase use MockTrait; protected $tmpData; - protected $removeDriverClass; + protected $remoteDriverClass; protected $tmpDocumentationFilePath; public function setUp(): void @@ -21,12 +21,12 @@ public function setUp(): void $this->tmpData = $this->getJsonFixture('tmp_data'); $this->tmpDocumentationFilePath = __DIR__ . '/../storage/temp_documentation.json'; - $this->removeDriverClass = new RemoteDriver(); + $this->remoteDriverClass = new RemoteDriver(); } public function testSaveTmpData() { - $this->removeDriverClass->saveTmpData($this->tmpData); + $this->remoteDriverClass->saveTmpData($this->tmpData); $this->assertFileExists($this->tmpDocumentationFilePath); $this->assertFileEquals($this->generateFixturePath('tmp_data_non_formatted.json'), $this->tmpDocumentationFilePath); @@ -36,14 +36,14 @@ public function testGetTmpData() { file_put_contents($this->tmpDocumentationFilePath, json_encode($this->tmpData)); - $result = $this->removeDriverClass->getTmpData(); + $result = $this->remoteDriverClass->getTmpData(); $this->assertEquals($this->tmpData, $result); } public function testGetTmpDataNoFile() { - $result = $this->removeDriverClass->getTmpData(); + $result = $this->remoteDriverClass->getTmpData(); $this->assertNull($result); } @@ -53,7 +53,7 @@ public function testSaveData() config(['auto-doc.drivers.remote.key' => 'mocked_key']); config(['auto-doc.drivers.remote.url' => 'mocked_url']); - $mock = $this->mockCLass(RemoteDriver::class, ['makeHttpRequest']); + $mock = $this->mockClass(RemoteDriver::class, ['makeHttpRequest']); $mock ->expects($this->once()) @@ -75,7 +75,7 @@ public function testSaveDataWithoutTmpFile() config(['auto-doc.drivers.remote.key' => 'mocked_key']); config(['auto-doc.drivers.remote.url' => 'mocked_url']); - $mock = $this->mockCLass(RemoteDriver::class, ['makeHttpRequest']); + $mock = $this->mockClass(RemoteDriver::class, ['makeHttpRequest']); $mock ->expects($this->once()) @@ -93,7 +93,7 @@ public function testGetDocumentation() config(['auto-doc.drivers.remote.key' => 'mocked_key']); config(['auto-doc.drivers.remote.url' => 'mocked_url']); - $mock = $this->mockCLass(RemoteDriver::class, ['makeHttpRequest']); + $mock = $this->mockClass(RemoteDriver::class, ['makeHttpRequest']); $mock ->expects($this->once()) @@ -113,7 +113,7 @@ public function testGetDocumentationNoFile() config(['auto-doc.drivers.remote.key' => 'mocked_key']); config(['auto-doc.drivers.remote.url' => 'mocked_url']); - $mock = $this->mockCLass(RemoteDriver::class, ['makeHttpRequest']); + $mock = $this->mockClass(RemoteDriver::class, ['makeHttpRequest']); $mock ->expects($this->once()) diff --git a/tests/fixtures/LocalDriverTest/tmp_data.json b/tests/fixtures/LocalDriverTest/tmp_data.json index d1e7d58..4c350c0 100644 --- a/tests/fixtures/LocalDriverTest/tmp_data.json +++ b/tests/fixtures/LocalDriverTest/tmp_data.json @@ -31,7 +31,7 @@ "description": "Operation successfully done", "schema": { "example": { - "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTE0NzY0ODAwLCJleHAiOjE1MTQ3Njg0MDAsIm5iZiI6MTUxNDc2NDgwMCwianRpIjoiM2tYM2tXQ3Z0UWdOSjBBOSIsInN1YiI6MiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.Trk1hpjhczDmu60vgKs1aYPl7wxWNJfNCYcW5mC0LQ8", + "token": "some_token", "user": { "id": 2, "email": "user@test.com", @@ -39,8 +39,6 @@ "created_at": "2017-11-16 06:08:34", "updated_at": "2018-01-01 00:00:00", "role_id": 2, - "clio_user_id": null, - "images_limit": 500, "state": "confirmed", "reset_password_hash": null, "failed_auth_attempts": 0, @@ -49,7 +47,6 @@ "last_name": null, "set_password_hash_created_at": null, "full_name": "user", - "settings": null, "new_email": "new_email_test2@test.com", "is_email_verified": true, "role": { @@ -58,22 +55,7 @@ "created_at": null, "updated_at": null, "settable": true - }, - "services": [ - { - "id": 1, - "name": "500px", - "created_at": "2017-11-16 06:08:34", - "updated_at": "2017-11-16 06:08:34", - "is_photo_service": true, - "allow_not_unique_accounts": false, - "pivot": { - "user_id": 2, - "service_id": 1, - "is_token_expired": 0 - } - } - ] + } }, "ttl": 60, "refresh_ttl": 20160 @@ -129,7 +111,7 @@ "info": { "description": "This is automatically collected documentation", "version": "0.0.0", - "title": "Photoclaim API", + "title": "Project Title", "termsOfService": "", "contact": { "email": "your@email.com" diff --git a/tests/fixtures/LocalDriverTest/tmp_data_non_formatted.json b/tests/fixtures/LocalDriverTest/tmp_data_non_formatted.json index 9dd48d8..3ac95f3 100644 --- a/tests/fixtures/LocalDriverTest/tmp_data_non_formatted.json +++ b/tests/fixtures/LocalDriverTest/tmp_data_non_formatted.json @@ -1 +1 @@ -{"swagger":"2.0","host":"localhost","basePath":"\/","schemes":[],"paths":{"\/auth\/login":{"post":{"tags":["auth"],"consumes":["application\/json"],"produces":["application\/json"],"parameters":[{"in":"body","name":"body","description":"","required":true,"schema":{"$ref":"#\/definitions\/authloginObject"}}],"responses":{"200":{"description":"Operation successfully done","schema":{"example":{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTE0NzY0ODAwLCJleHAiOjE1MTQ3Njg0MDAsIm5iZiI6MTUxNDc2NDgwMCwianRpIjoiM2tYM2tXQ3Z0UWdOSjBBOSIsInN1YiI6MiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.Trk1hpjhczDmu60vgKs1aYPl7wxWNJfNCYcW5mC0LQ8","user":{"id":2,"email":"user@test.com","deleted_at":null,"created_at":"2017-11-16 06:08:34","updated_at":"2018-01-01 00:00:00","role_id":2,"clio_user_id":null,"images_limit":500,"state":"confirmed","reset_password_hash":null,"failed_auth_attempts":0,"last_auth_attempt":"2018-01-01 00:00:00","first_name":"user","last_name":null,"set_password_hash_created_at":null,"full_name":"user","settings":null,"new_email":"new_email_test2@test.com","is_email_verified":true,"role":{"id":2,"name":"client","created_at":null,"updated_at":null,"settable":true},"services":[{"id":1,"name":"500px","created_at":"2017-11-16 06:08:34","updated_at":"2017-11-16 06:08:34","is_photo_service":true,"allow_not_unique_accounts":false,"pivot":{"user_id":2,"service_id":1,"is_token_expired":0}}]},"ttl":60,"refresh_ttl":20160}}},"401":{"description":"Unauthorized","schema":{"example":{"error":"You have entered an incorrect credentials."}}},"400":{"description":"Bad Request","schema":{"example":{"error":"The limit of failed authorization attempts has been reached. You can't login in next 50 minutes."}}}},"security":[],"description":"","summary":"login"}}},"definitions":{"authloginObject":{"type":"object","properties":{"email":{"type":"string","description":"2"},"password":{"type":"string","description":""}},"required":["email","password"],"example":{"email":"admin@test.com","password":"123"}}},"info":{"description":"This is automatically collected documentation","version":"0.0.0","title":"Photoclaim API","termsOfService":"","contact":{"email":"your@email.com"}}} \ No newline at end of file +{"swagger":"2.0","host":"localhost","basePath":"\/","schemes":[],"paths":{"\/auth\/login":{"post":{"tags":["auth"],"consumes":["application\/json"],"produces":["application\/json"],"parameters":[{"in":"body","name":"body","description":"","required":true,"schema":{"$ref":"#\/definitions\/authloginObject"}}],"responses":{"200":{"description":"Operation successfully done","schema":{"example":{"token":"some_token","user":{"id":2,"email":"user@test.com","deleted_at":null,"created_at":"2017-11-16 06:08:34","updated_at":"2018-01-01 00:00:00","role_id":2,"state":"confirmed","reset_password_hash":null,"failed_auth_attempts":0,"last_auth_attempt":"2018-01-01 00:00:00","first_name":"user","last_name":null,"set_password_hash_created_at":null,"full_name":"user","new_email":"new_email_test2@test.com","is_email_verified":true,"role":{"id":2,"name":"client","created_at":null,"updated_at":null,"settable":true}},"ttl":60,"refresh_ttl":20160}}},"401":{"description":"Unauthorized","schema":{"example":{"error":"You have entered an incorrect credentials."}}},"400":{"description":"Bad Request","schema":{"example":{"error":"The limit of failed authorization attempts has been reached. You can't login in next 50 minutes."}}}},"security":[],"description":"","summary":"login"}}},"definitions":{"authloginObject":{"type":"object","properties":{"email":{"type":"string","description":"2"},"password":{"type":"string","description":""}},"required":["email","password"],"example":{"email":"admin@test.com","password":"123"}}},"info":{"description":"This is automatically collected documentation","version":"0.0.0","title":"Project Title","termsOfService":"","contact":{"email":"your@email.com"}}} \ No newline at end of file diff --git a/tests/fixtures/RemoteDriverTest/tmp_data.json b/tests/fixtures/RemoteDriverTest/tmp_data.json index d1e7d58..4c350c0 100644 --- a/tests/fixtures/RemoteDriverTest/tmp_data.json +++ b/tests/fixtures/RemoteDriverTest/tmp_data.json @@ -31,7 +31,7 @@ "description": "Operation successfully done", "schema": { "example": { - "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTE0NzY0ODAwLCJleHAiOjE1MTQ3Njg0MDAsIm5iZiI6MTUxNDc2NDgwMCwianRpIjoiM2tYM2tXQ3Z0UWdOSjBBOSIsInN1YiI6MiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.Trk1hpjhczDmu60vgKs1aYPl7wxWNJfNCYcW5mC0LQ8", + "token": "some_token", "user": { "id": 2, "email": "user@test.com", @@ -39,8 +39,6 @@ "created_at": "2017-11-16 06:08:34", "updated_at": "2018-01-01 00:00:00", "role_id": 2, - "clio_user_id": null, - "images_limit": 500, "state": "confirmed", "reset_password_hash": null, "failed_auth_attempts": 0, @@ -49,7 +47,6 @@ "last_name": null, "set_password_hash_created_at": null, "full_name": "user", - "settings": null, "new_email": "new_email_test2@test.com", "is_email_verified": true, "role": { @@ -58,22 +55,7 @@ "created_at": null, "updated_at": null, "settable": true - }, - "services": [ - { - "id": 1, - "name": "500px", - "created_at": "2017-11-16 06:08:34", - "updated_at": "2017-11-16 06:08:34", - "is_photo_service": true, - "allow_not_unique_accounts": false, - "pivot": { - "user_id": 2, - "service_id": 1, - "is_token_expired": 0 - } - } - ] + } }, "ttl": 60, "refresh_ttl": 20160 @@ -129,7 +111,7 @@ "info": { "description": "This is automatically collected documentation", "version": "0.0.0", - "title": "Photoclaim API", + "title": "Project Title", "termsOfService": "", "contact": { "email": "your@email.com" diff --git a/tests/fixtures/RemoteDriverTest/tmp_data_non_formatted.json b/tests/fixtures/RemoteDriverTest/tmp_data_non_formatted.json index 9dd48d8..3ac95f3 100644 --- a/tests/fixtures/RemoteDriverTest/tmp_data_non_formatted.json +++ b/tests/fixtures/RemoteDriverTest/tmp_data_non_formatted.json @@ -1 +1 @@ -{"swagger":"2.0","host":"localhost","basePath":"\/","schemes":[],"paths":{"\/auth\/login":{"post":{"tags":["auth"],"consumes":["application\/json"],"produces":["application\/json"],"parameters":[{"in":"body","name":"body","description":"","required":true,"schema":{"$ref":"#\/definitions\/authloginObject"}}],"responses":{"200":{"description":"Operation successfully done","schema":{"example":{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTE0NzY0ODAwLCJleHAiOjE1MTQ3Njg0MDAsIm5iZiI6MTUxNDc2NDgwMCwianRpIjoiM2tYM2tXQ3Z0UWdOSjBBOSIsInN1YiI6MiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.Trk1hpjhczDmu60vgKs1aYPl7wxWNJfNCYcW5mC0LQ8","user":{"id":2,"email":"user@test.com","deleted_at":null,"created_at":"2017-11-16 06:08:34","updated_at":"2018-01-01 00:00:00","role_id":2,"clio_user_id":null,"images_limit":500,"state":"confirmed","reset_password_hash":null,"failed_auth_attempts":0,"last_auth_attempt":"2018-01-01 00:00:00","first_name":"user","last_name":null,"set_password_hash_created_at":null,"full_name":"user","settings":null,"new_email":"new_email_test2@test.com","is_email_verified":true,"role":{"id":2,"name":"client","created_at":null,"updated_at":null,"settable":true},"services":[{"id":1,"name":"500px","created_at":"2017-11-16 06:08:34","updated_at":"2017-11-16 06:08:34","is_photo_service":true,"allow_not_unique_accounts":false,"pivot":{"user_id":2,"service_id":1,"is_token_expired":0}}]},"ttl":60,"refresh_ttl":20160}}},"401":{"description":"Unauthorized","schema":{"example":{"error":"You have entered an incorrect credentials."}}},"400":{"description":"Bad Request","schema":{"example":{"error":"The limit of failed authorization attempts has been reached. You can't login in next 50 minutes."}}}},"security":[],"description":"","summary":"login"}}},"definitions":{"authloginObject":{"type":"object","properties":{"email":{"type":"string","description":"2"},"password":{"type":"string","description":""}},"required":["email","password"],"example":{"email":"admin@test.com","password":"123"}}},"info":{"description":"This is automatically collected documentation","version":"0.0.0","title":"Photoclaim API","termsOfService":"","contact":{"email":"your@email.com"}}} \ No newline at end of file +{"swagger":"2.0","host":"localhost","basePath":"\/","schemes":[],"paths":{"\/auth\/login":{"post":{"tags":["auth"],"consumes":["application\/json"],"produces":["application\/json"],"parameters":[{"in":"body","name":"body","description":"","required":true,"schema":{"$ref":"#\/definitions\/authloginObject"}}],"responses":{"200":{"description":"Operation successfully done","schema":{"example":{"token":"some_token","user":{"id":2,"email":"user@test.com","deleted_at":null,"created_at":"2017-11-16 06:08:34","updated_at":"2018-01-01 00:00:00","role_id":2,"state":"confirmed","reset_password_hash":null,"failed_auth_attempts":0,"last_auth_attempt":"2018-01-01 00:00:00","first_name":"user","last_name":null,"set_password_hash_created_at":null,"full_name":"user","new_email":"new_email_test2@test.com","is_email_verified":true,"role":{"id":2,"name":"client","created_at":null,"updated_at":null,"settable":true}},"ttl":60,"refresh_ttl":20160}}},"401":{"description":"Unauthorized","schema":{"example":{"error":"You have entered an incorrect credentials."}}},"400":{"description":"Bad Request","schema":{"example":{"error":"The limit of failed authorization attempts has been reached. You can't login in next 50 minutes."}}}},"security":[],"description":"","summary":"login"}}},"definitions":{"authloginObject":{"type":"object","properties":{"email":{"type":"string","description":"2"},"password":{"type":"string","description":""}},"required":["email","password"],"example":{"email":"admin@test.com","password":"123"}}},"info":{"description":"This is automatically collected documentation","version":"0.0.0","title":"Project Title","termsOfService":"","contact":{"email":"your@email.com"}}} \ No newline at end of file diff --git a/tests/fixtures/StorageDriverTest/tmp_data.json b/tests/fixtures/StorageDriverTest/tmp_data.json index d1e7d58..4c350c0 100644 --- a/tests/fixtures/StorageDriverTest/tmp_data.json +++ b/tests/fixtures/StorageDriverTest/tmp_data.json @@ -31,7 +31,7 @@ "description": "Operation successfully done", "schema": { "example": { - "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTE0NzY0ODAwLCJleHAiOjE1MTQ3Njg0MDAsIm5iZiI6MTUxNDc2NDgwMCwianRpIjoiM2tYM2tXQ3Z0UWdOSjBBOSIsInN1YiI6MiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.Trk1hpjhczDmu60vgKs1aYPl7wxWNJfNCYcW5mC0LQ8", + "token": "some_token", "user": { "id": 2, "email": "user@test.com", @@ -39,8 +39,6 @@ "created_at": "2017-11-16 06:08:34", "updated_at": "2018-01-01 00:00:00", "role_id": 2, - "clio_user_id": null, - "images_limit": 500, "state": "confirmed", "reset_password_hash": null, "failed_auth_attempts": 0, @@ -49,7 +47,6 @@ "last_name": null, "set_password_hash_created_at": null, "full_name": "user", - "settings": null, "new_email": "new_email_test2@test.com", "is_email_verified": true, "role": { @@ -58,22 +55,7 @@ "created_at": null, "updated_at": null, "settable": true - }, - "services": [ - { - "id": 1, - "name": "500px", - "created_at": "2017-11-16 06:08:34", - "updated_at": "2017-11-16 06:08:34", - "is_photo_service": true, - "allow_not_unique_accounts": false, - "pivot": { - "user_id": 2, - "service_id": 1, - "is_token_expired": 0 - } - } - ] + } }, "ttl": 60, "refresh_ttl": 20160 @@ -129,7 +111,7 @@ "info": { "description": "This is automatically collected documentation", "version": "0.0.0", - "title": "Photoclaim API", + "title": "Project Title", "termsOfService": "", "contact": { "email": "your@email.com" diff --git a/tests/fixtures/StorageDriverTest/tmp_data_non_formatted.json b/tests/fixtures/StorageDriverTest/tmp_data_non_formatted.json index 9dd48d8..3ac95f3 100644 --- a/tests/fixtures/StorageDriverTest/tmp_data_non_formatted.json +++ b/tests/fixtures/StorageDriverTest/tmp_data_non_formatted.json @@ -1 +1 @@ -{"swagger":"2.0","host":"localhost","basePath":"\/","schemes":[],"paths":{"\/auth\/login":{"post":{"tags":["auth"],"consumes":["application\/json"],"produces":["application\/json"],"parameters":[{"in":"body","name":"body","description":"","required":true,"schema":{"$ref":"#\/definitions\/authloginObject"}}],"responses":{"200":{"description":"Operation successfully done","schema":{"example":{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTE0NzY0ODAwLCJleHAiOjE1MTQ3Njg0MDAsIm5iZiI6MTUxNDc2NDgwMCwianRpIjoiM2tYM2tXQ3Z0UWdOSjBBOSIsInN1YiI6MiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.Trk1hpjhczDmu60vgKs1aYPl7wxWNJfNCYcW5mC0LQ8","user":{"id":2,"email":"user@test.com","deleted_at":null,"created_at":"2017-11-16 06:08:34","updated_at":"2018-01-01 00:00:00","role_id":2,"clio_user_id":null,"images_limit":500,"state":"confirmed","reset_password_hash":null,"failed_auth_attempts":0,"last_auth_attempt":"2018-01-01 00:00:00","first_name":"user","last_name":null,"set_password_hash_created_at":null,"full_name":"user","settings":null,"new_email":"new_email_test2@test.com","is_email_verified":true,"role":{"id":2,"name":"client","created_at":null,"updated_at":null,"settable":true},"services":[{"id":1,"name":"500px","created_at":"2017-11-16 06:08:34","updated_at":"2017-11-16 06:08:34","is_photo_service":true,"allow_not_unique_accounts":false,"pivot":{"user_id":2,"service_id":1,"is_token_expired":0}}]},"ttl":60,"refresh_ttl":20160}}},"401":{"description":"Unauthorized","schema":{"example":{"error":"You have entered an incorrect credentials."}}},"400":{"description":"Bad Request","schema":{"example":{"error":"The limit of failed authorization attempts has been reached. You can't login in next 50 minutes."}}}},"security":[],"description":"","summary":"login"}}},"definitions":{"authloginObject":{"type":"object","properties":{"email":{"type":"string","description":"2"},"password":{"type":"string","description":""}},"required":["email","password"],"example":{"email":"admin@test.com","password":"123"}}},"info":{"description":"This is automatically collected documentation","version":"0.0.0","title":"Photoclaim API","termsOfService":"","contact":{"email":"your@email.com"}}} \ No newline at end of file +{"swagger":"2.0","host":"localhost","basePath":"\/","schemes":[],"paths":{"\/auth\/login":{"post":{"tags":["auth"],"consumes":["application\/json"],"produces":["application\/json"],"parameters":[{"in":"body","name":"body","description":"","required":true,"schema":{"$ref":"#\/definitions\/authloginObject"}}],"responses":{"200":{"description":"Operation successfully done","schema":{"example":{"token":"some_token","user":{"id":2,"email":"user@test.com","deleted_at":null,"created_at":"2017-11-16 06:08:34","updated_at":"2018-01-01 00:00:00","role_id":2,"state":"confirmed","reset_password_hash":null,"failed_auth_attempts":0,"last_auth_attempt":"2018-01-01 00:00:00","first_name":"user","last_name":null,"set_password_hash_created_at":null,"full_name":"user","new_email":"new_email_test2@test.com","is_email_verified":true,"role":{"id":2,"name":"client","created_at":null,"updated_at":null,"settable":true}},"ttl":60,"refresh_ttl":20160}}},"401":{"description":"Unauthorized","schema":{"example":{"error":"You have entered an incorrect credentials."}}},"400":{"description":"Bad Request","schema":{"example":{"error":"The limit of failed authorization attempts has been reached. You can't login in next 50 minutes."}}}},"security":[],"description":"","summary":"login"}}},"definitions":{"authloginObject":{"type":"object","properties":{"email":{"type":"string","description":"2"},"password":{"type":"string","description":""}},"required":["email","password"],"example":{"email":"admin@test.com","password":"123"}}},"info":{"description":"This is automatically collected documentation","version":"0.0.0","title":"Project Title","termsOfService":"","contact":{"email":"your@email.com"}}} \ No newline at end of file diff --git a/tests/support/Traits/MockTrait.php b/tests/support/Traits/MockTrait.php index 9d049fa..5d06368 100644 --- a/tests/support/Traits/MockTrait.php +++ b/tests/support/Traits/MockTrait.php @@ -4,7 +4,7 @@ trait MockTrait { - protected function mockCLass($className, $methods = []) + protected function mockClass($className, $methods = []) { return $this ->getMockBuilder($className) diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index 7b5ae76..8ec68bf 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -8,14 +8,14 @@ trait SwaggerServiceMockTrait { use MockTrait; - protected function mockDriverSaveTmpData($expectedData) + protected function mockDriverSaveTmpData($expectedData, $driverClass = LocalDriver::class) { - $driver = $this->mockCLass(LocalDriver::class, ['saveTmpData']); + $driver = $this->mockClass($driverClass, ['saveTmpData']); $firstCall = array_merge($expectedData, ['paths' => []]); $driver->expects($this->exactly(2))->method('saveTmpData')->withConsecutive([$firstCall], [$expectedData]); - $this->app->instance(LocalDriver::class, $driver); + $this->app->instance($driverClass, $driver); } }