Skip to content

Commit

Permalink
Delete skipped tests non PHP 7 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoologic committed Nov 15, 2023
1 parent 339610d commit ca1f2c9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 60 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ services:
volumes:
- .:/app
- vendor:/app/vendor
command: vendor/bin/phpunit --testsuite "Zendesk API Unit Test Suites"
# command: vendor/bin/phpunit --testsuite "Zendesk API Unit Test Suites"
# command: vendor/bin/phpunit --testdox --testsuite "Zendesk API Unit Test Suites"
# command: vendor/bin/phpunit tests/Zendesk/API/UnitTests/Traits/Utility/PaginationIteratorTest.php
# command: vendor/bin/phpunit tests/Zendesk/API/UnitTests/Core/TicketsTest.php
# command: vendor/bin/phpunit tests/Zendesk/API/UnitTests/Core/TagsTest.php
command: vendor/bin/phpunit tests/Zendesk/API/UnitTests/HttpTest.php

volumes:
vendor:
4 changes: 2 additions & 2 deletions src/Zendesk/API/Traits/Utility/Pagination/CbpStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function params()
* OBP: https://{subdomain}.zendesk.com/api/v2/tickets?sort_order=desc&sort_by=updated_at&per_page=2
* CBP: https://{subdomain}.zendesk.com/api/v2/tickets?sort=-updated_at&page[size]=2
*
* @return array all params with CBP sorting order
* @return array Params with proper CBP sorting order
*/
private function sortParams()
{
Expand All @@ -58,7 +58,7 @@ private function sortParams()
* The params that are needed to for pagination (eg: ["page[size]" => "100"])
* If OBP params are passed, they are converted to CBP
*
* @return array all params with CBP sorting order
* @return array Params for pagination
*/
private function paginationParams()
{
Expand Down
5 changes: 0 additions & 5 deletions src/Zendesk/API/Traits/Utility/Pagination/ObpStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,4 @@ public function page($getPageFn)
public function shouldGetPage($position) {
return $this->pageNumber == 0 || $position >= $this->pageNumber * $this->pageSize();
}
public function paramsWithPagination()
{
return ['page' => $this->pageNumber, 'per_page' => $this->pageSize()];

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class PaginationIterator implements Iterator
private $items = [];

/**
*
* @param mixed using trait FindAll. The resources collection, Eg: `$client->tickets()` which uses FindAll
* @param AbstractStrategy $strategy For pagination Logic (OBP, CBP, SinglePage)
* @param string $method used to make the API call
Expand Down
33 changes: 0 additions & 33 deletions tests/Zendesk/API/UnitTests/Core/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

namespace Zendesk\API\UnitTests\Core;

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Zendesk\API\Http;
use Zendesk\API\HttpClient;
use Zendesk\API\UnitTests\BasicTest;
use Zendesk\API\Utilities\Auth;

Expand All @@ -15,35 +11,6 @@
*/
class AuthTest extends BasicTest
{
/**
* Test if request is still sent even without authentication
*/
public function testAnonymousAccess()
{
$this->markTestSkipped('Broken in PHP 7.4 (mocking)');

// mock client
$client = $this
->getMockBuilder(HttpClient::class)
->disableOriginalConstructor()
->getMock();
$client->method('getHeaders')->willReturn([]);
$client->expects(self::once())->method('getAuth')->willReturn(null);

// prepareRequest should not be called
$auth = $this
->getMockBuilder(Auth::class)
->disableOriginalConstructor()
->getMock();
$auth->expects(self::never())->method('prepareRequest');
$client->expects(self::once())->method('getAuth')->willReturn($auth);

// send request
$client->guzzle = $this->getMockBuilder(Client::class)->getMock();
$client->guzzle->method('send')->willReturn(new Response(200, [], ''));
Http::send($client, '');
}

/**
* Test the preparing of a request for basic authentication.
*/
Expand Down
24 changes: 10 additions & 14 deletions tests/Zendesk/API/UnitTests/Exceptions/ApiResponseExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@

namespace Zendesk\API\UnitTests\Exceptions;

use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Zendesk\API\UnitTests\BasicTest;
use Zendesk\API\Exceptions\ApiResponseException;

class ApiResponseExceptionTest extends BasicTest
{
/**
* Tests if previous exception was passed to ApiResponseException
*/
public function testPreviousException()
public function testServerException()
{
$this->markTestSkipped('Broken in PHP 7.4 (mocking)');
$request = new Request("GET","");
$response = new Response(200, ["Content-Type"=> "application/json"],"");
$requestException = new ServerException("test", $request, $response);

$message = 'The previous exception was not passed to ApiResponseException';
$mockException = $this
->getMockBuilder('GuzzleHttp\Exception\RequestException')
->disableOriginalConstructor()
->getMock();
$mockException->method('hasResponse')->willReturn(true);
$apiException = new ApiResponseException($mockException);
$previousException = $apiException->getPrevious();
$subject = new ApiResponseException($requestException);

$this->assertEquals($mockException, $previousException, $message);
$this->assertEquals([], $subject->getErrorDetails());
}
}
3 changes: 0 additions & 3 deletions tests/Zendesk/API/UnitTests/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

class HttpTest extends BasicTest
{
/**
* Test that original request exception is preserved.
*/
public function testOriginalRequestExceptionIsPreserved()
{
$this->markTestSkipped('Broken in PHP 7.4 (mocking)');
Expand Down

0 comments on commit ca1f2c9

Please sign in to comment.