Skip to content

Commit

Permalink
Upgrading HttpPlayback and PHPUnit to allow for PHP8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Garethp committed May 10, 2021
1 parent 45d924c commit 2803045
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 44 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.10.0 - 2021-05-10
* Upgrading the version of Guzzle that's used in HttpPlayback
* Upgrading the version of PHPUnit used to allow for PHP 8
* This breaks backwards compatibility with PHP 5.x

## 0.9.9 - 2020-09-15
* Fixing issue of any non-success responses failing XML check (since the body is not XML)
* Fixing a problem with contacts over a different primary address introduced in `0.9.7`
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "garethp/php-ews",
"license": "BSD-3-Clause",
"description": "A PHP Library to interact with the Exchange SOAP service",
"require": {
"garethp/http-playback": "^1.0",
"garethp/http-playback": "^2.0",
"ext-curl": "*",
"ext-soap": "*",
"ext-libxml": "*",
Expand All @@ -27,8 +28,8 @@
]
},
"require-dev": {
"phpunit/phpunit": "~4.8|~5.2",
"squizlabs/php_codesniffer": "~2.3",
"phpunit/phpunit": "~9.5",
"squizlabs/php_codesniffer": "~3.6.0",
"mockery/mockery": "~0.9.4",
"goetas/xsd2php": "2.*@dev",
"goetas/xsd-reader": "2.*@dev"
Expand Down
7 changes: 4 additions & 3 deletions examples/basic/authenticatingWithOAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
'&scope=' . urlencode('full_access_as_user');
header("Location: {$redirect}");
exit();
} //Once you have your code, you can exchange it for a token. The code can only be used once, so you don't store the code.
//The token is what we'll be using for the duration of the session, so you should store between pages.
elseif (isset($_GET['code'])) {
} elseif (isset($_GET['code'])) {
//Once you have your code, you can exchange it for a token. The code can only be used once, so you don't store the code.
//The token is what we'll be using for the duration of the session, so you should store between pages.

$code = $_GET['code'];

$token = ExchangeWebServicesAuth::getTokenFromAuthorizationCode(
Expand Down
7 changes: 3 additions & 4 deletions tests/src/API/ExchangeAutodiscoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use garethp\ews\API;
use garethp\ews\API\ExchangeAutodiscover as Autodiscover;
use garethp\ews\API\Exception\AutodiscoverFailed;
use PHPUnit\Framework\TestCase;

class ExchangeAutodiscoverTest extends \PHPUnit_Framework_TestCase
class ExchangeAutodiscoverTest extends TestCase
{
public function testGetAPI()
{
Expand Down Expand Up @@ -42,11 +43,9 @@ public function testGetAPI()
$this->assertInstanceOf(API::class, $client);
}

/**
* @expectedException \garethp\ews\API\Exception\AutodiscoverFailed
*/
public function testGetAPIFailure()
{
$this->expectException(AutodiscoverFailed::class);
$mode = getenv('HttpPlayback');
if ($mode == false) {
$mode = 'playback';
Expand Down
4 changes: 2 additions & 2 deletions tests/src/API/ExchangeWebServicesAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use garethp\ews\API\ExchangeWebServicesAuth;
use garethp\ews\API\Type;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class ExchangeWebServicesAuthTest extends PHPUnit_Framework_TestCase
class ExchangeWebServicesAuthTest extends TestCase
{
public function testFromUsernameAndPassword()
{
Expand Down
11 changes: 4 additions & 7 deletions tests/src/API/ExchangeWebServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@

namespace garethp\ews\Test\API;

use garethp\ews\API\ClassMap;
use garethp\ews\API\ExchangeWebServices;
use garethp\ews\API\ExchangeWebServicesAuth;
use garethp\ews\API\NTLMSoapClient;
use garethp\ews\API\Type;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class ExchangeWebServicesTest extends PHPUnit_Framework_TestCase
class ExchangeWebServicesTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
Mockery::close();
}
Expand All @@ -43,7 +40,7 @@ public function testCleanServerUrl($input, $expected)

$this->assertEquals($expected, $actual);
}

public function testPrimarySmtpMailbox()
{
$client = $this->getClientMock();
Expand Down
3 changes: 2 additions & 1 deletion tests/src/API/FieldURIManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use garethp\ews\API\Enumeration\DictionaryURIType;
use garethp\ews\API\Enumeration\UnindexedFieldURIType;
use garethp\ews\API\FieldURIManager;
use PHPUnit\Framework\TestCase;

class FieldURIManagerTest extends \PHPUnit_Framework_TestCase
class FieldURIManagerTest extends TestCase
{
public function testGetFieldUrisFromClass()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/src/API/NTLMSoapClient/ExchangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace garethp\ews\Test\API\NTLMSoapClient;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Mockery;

class ExchangeTest extends PHPUnit_Framework_TestCase
class ExchangeTest extends TestCase
{
public function testDummy()
{
Expand Down
7 changes: 0 additions & 7 deletions tests/src/API/NTLMSoapClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,9 @@
namespace garethp\ews\Test\API;

use garethp\ews\Test\BaseTestCase;
use GuzzleHttp\Client;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use garethp\ews\API\NTLMSoapClient;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
use Mockery;
use GuzzleHttp\Middleware;
use SoapHeader;
use garethp\ews\API;

class NTLMSoapClientTest extends BaseTestCase
Expand Down
7 changes: 3 additions & 4 deletions tests/src/API/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
namespace garethp\ews\Test\API;

use garethp\ews\API\Type;
use garethp\ews\API\Message;
use garethp\ews\API\Enumeration;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Mockery;
use DateTime;

class TypeTest extends PHPUnit_Framework_TestCase
class TypeTest extends TestCase
{
private $typeMock;

Expand Down Expand Up @@ -43,10 +42,10 @@ public function testMagicCall()

/**
* @dataProvider magicExceptionProvider
* @expectedException \Exception
*/
public function testMagicCallFail($callName, $value = null)
{
$this->expectException(\Exception::class);
$calendarItem = new Type\CalendarItemType();

if ($value === null) {
Expand Down
7 changes: 3 additions & 4 deletions tests/src/APITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,11 @@ public function testDeleteItems()
$this->assertTrue($client->deleteItems($item, ['SendMeetingCancellations' => 'SendToNone']));
}

/**
* @expectedException \Exception
* @expectedExceptionMessage The specified object was not found in the store
*/
public function testDeleteItemsFail()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage("The specified object was not found in the store");

$client = $this->getClient();
$start = new \DateTime();
$args = array(
Expand Down
3 changes: 2 additions & 1 deletion tests/src/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace garethp\ews\Test;

use garethp\ews\API;
use PHPUnit\Framework\TestCase;

class BaseTestCase extends \PHPUnit_Framework_TestCase
class BaseTestCase extends TestCase
{
/**
* @param null $apiClass
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Calendar/CalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

class APITest extends BaseTestCase
{
public function setUp()
public function setUp(): void
{
$client = $this->getClient();
$client->deleteAllCalendarItems('2015-07-01 00:00', '2015-07-01 23:59');
}

public function tearDown()
public function tearDown(): void
{
$client = $this->getClient();
$client->deleteAllCalendarItems('2015-07-01 00:00', '2015-07-01 23:59');
Expand Down
3 changes: 2 additions & 1 deletion tests/src/CasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
namespace garethp\ews\Test;

use garethp\ews\Caster;
use PHPUnit\Framework\TestCase;

class CasterTest extends \PHPUnit_Framework_TestCase
class CasterTest extends TestCase
{
/**
* @param $input
Expand Down
1 change: 0 additions & 1 deletion tests/src/Contacts/ContactsAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use garethp\ews\API\Type\ItemIdType;
use garethp\ews\API\Type\PhysicalAddressDictionaryEntryType;
use garethp\ews\Test\BaseTestCase;
use PHPUnit_Framework_TestCase;
use garethp\ews\ContactsAPI as API;

class ContactsAPITest extends BaseTestCase
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Mail/MailAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class MailAPITest extends BaseTestCase
{
public function setUp()
public function setUp(): void
{
$client = $this->getClient();
$items = $client->getMailItems();
Expand All @@ -19,7 +19,7 @@ public function setUp()
}
}

public function tearDown()
public function tearDown(): void
{
$client = $this->getClient();
$items = $client->getMailItems();
Expand Down

0 comments on commit 2803045

Please sign in to comment.