浏览代码

fix last failing unit-tests

Olivier Massot 3 年之前
父节点
当前提交
67f6319e83

+ 1 - 1
tests/Service/Dolibarr/DolibarrApiServiceTest.php

@@ -39,7 +39,7 @@ class DolibarrApiServiceTest extends TestCase
         $this->client
             ->expects($this->once())
             ->method('request')
-            ->with("GET", "thirdparties?sqlfilters=ref_int%3D1")
+            ->with("GET", "thirdparties?limit=1&sqlfilters=ref_int%3D1")
             ->willReturn($response);
 
         $data = $this->dolibarrApiService->getSociety(1);

+ 3 - 9
tests/Service/Rest/Operation/BaseRestOperationTest.php

@@ -58,9 +58,7 @@ class BaseRestOperationTest extends TestCase
             ->with('PUT', 'entity/1', [], ['json' => '{"a":1}'])
             ->willReturn($responseOk);
 
-        $operation->setApiRequestService($this->apiRequestService);
-
-        $operation->execute();
+        $operation->execute($this->apiRequestService);
         $this->assertEquals(BaseRestOperation::STATUS_DONE, $operation->getStatus());
         $this->assertEquals("", $operation->getErrorMessage());
     }
@@ -84,9 +82,7 @@ class BaseRestOperationTest extends TestCase
             ->with('PUT', 'entity/2')
             ->willReturn($responseError);
 
-        $operation->setApiRequestService($this->apiRequestService);
-
-        $operation->execute();
+        $operation->execute($this->apiRequestService);
         $this->assertEquals(BaseRestOperation::STATUS_ERROR, $operation->getStatus());
         $this->assertEquals('Error 404 : Not found', $operation->getErrorMessage());
     }
@@ -114,9 +110,7 @@ class BaseRestOperationTest extends TestCase
             ->with('PUT', 'entity/3')
             ->willThrowException(new ClientException($responseException));
 
-        $operation->setApiRequestService($this->apiRequestService);
-
-        $operation->execute();
+        $operation->execute($this->apiRequestService);
         $this->assertEquals(BaseRestOperation::STATUS_ERROR, $operation->getStatus());
         $this->assertMatchesRegularExpression(
             '/.*ClientException: HTTP 500 returned for "entity\/3".*/',

+ 1 - 1
tests/Service/Rest/Operation/DeleteOperationTest.php

@@ -4,7 +4,7 @@ use App\Service\Rest\Operation\CreateOperation;
 use App\Service\Rest\Operation\DeleteOperation;
 use PHPUnit\Framework\TestCase;
 
-class CreateOperationTest extends TestCase
+class DeleteOperationTest extends TestCase
 {
     public function testGetters() {
         $operation = new DeleteOperation(

+ 1 - 1
tests/Service/Rest/Operation/UpdateOperationTest.php

@@ -4,7 +4,7 @@ use App\Service\Rest\Operation\CreateOperation;
 use App\Service\Rest\Operation\UpdateOperation;
 use PHPUnit\Framework\TestCase;
 
-class CreateOperationTest extends TestCase
+class UpdateOperationTest extends TestCase
 {
     public function testGetters() {
         $operation = new UpdateOperation(