diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 6358886e..ab2a9443 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -16,14 +16,11 @@ jobs: - uses: php-actions/composer@v6 - - name: Run Tests - uses: php-actions/phpunit@v3 + - name: Run Unit Tests + run: vendor/bin/phpunit --group unit--coverage-text --coverage-clover=coverage/coverage.xml --configuration=phpunit.xml.dist env: LOB_API_TEST_KEY: ${{ secrets.LOB_API_TEST_KEY }} LOB_API_LIVE_KEY: ${{ secrets.LOB_API_LIVE_KEY }} XDEBUG_MODE: coverage - with: - bootstrap: vendor/autoload.php - configuration: phpunit.xml.dist - php_extensions: xdebug - args: --coverage-text --coverage-clover=coverage/coverage.xml + + # TODO: Run Integration Tests diff --git a/lib/Api/LettersApi.php b/lib/Api/LettersApi.php index b3dd3da7..5aabe99a 100755 --- a/lib/Api/LettersApi.php +++ b/lib/Api/LettersApi.php @@ -340,17 +340,21 @@ public function createWithHttpInfo($letter_editable, $idempotency_key = null, $f $options = $this->createHttpClientOption(); $requestError = null; try { - $response = $this->client->request( - 'POST', - $request->getUri()->__toString(), - [ - 'multipart' => [[ - 'name' => 'file', - 'contents' => Utils::tryFopen($file, 'r') - ]], - 'auth' => $options['auth'] - ] - ); + if ($file !== null) { + $response = $this->client->request( + 'POST', + $request->getUri()->__toString(), + [ + 'multipart' => [[ + 'name' => 'file', + 'contents' => Utils::tryFopen($file, 'r') + ]], + 'auth' => $options['auth'] + ] + ); + } else { + $response = $this->client->send($request, $options); + } } catch (RequestException $e) { $errorBody = json_decode($e->getResponse()->getBody()->getContents())->error; $requestError = new LobError(); diff --git a/lib/Model/Letter.php b/lib/Model/Letter.php index 450bfbba..fa2b027a 100755 --- a/lib/Model/Letter.php +++ b/lib/Model/Letter.php @@ -1108,12 +1108,6 @@ public function getTrackingEvents() */ public function setTrackingEvents($tracking_events) { - if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - - if (!is_null($tracking_events) && (count($tracking_events) > 0)) { - throw new \InvalidArgumentException('invalid value for $tracking_events when calling Letter., number of items must be less than or equal to 0.'); - } - } $this->container['tracking_events'] = []; if ($tracking_events) { foreach ($tracking_events as $point) {