Skip to content

Commit

Permalink
Update dataProviders in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Garethp committed Aug 24, 2024
1 parent 0ab2182 commit cfd9de6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 49 deletions.
8 changes: 2 additions & 6 deletions tests/src/API/ExchangeAutodiscoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use garethp\ews\API\ExchangeAutodiscover as Autodiscover;
use garethp\ews\API\Exception\AutodiscoverFailed;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;

class ExchangeAutodiscoverTest extends TestCase
{
Expand Down Expand Up @@ -67,12 +68,7 @@ public function testGetAPIFailure()
$this->assertInstanceOf(API::class, $client);
}

/**
* @dataProvider serverVersionProvider
*
* @param $hex
* @param $expectedVersion
*/
#[DataProvider('serverVersionProvider')]
public function testParseServerVersion($hex, $expectedVersion)
{
$reflectedClass = new \ReflectionClass(Autodiscover::class);
Expand Down
8 changes: 2 additions & 6 deletions tests/src/API/ExchangeWebServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use garethp\ews\API\Type;
use Mockery;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;

class ExchangeWebServicesTest extends TestCase
{
Expand All @@ -27,12 +28,7 @@ public function getClientMock()
return $mock;
}

/**
*
* @dataProvider cleanServerUrlProvider
* @param $input
* @param $expected
*/
#[DataProvider('cleanServerUrlProvider')]
public function testCleanServerUrl($input, $expected)
{
$client = $this->getClientMock();
Expand Down
12 changes: 3 additions & 9 deletions tests/src/API/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PHPUnit\Framework\TestCase;
use Mockery;
use DateTime;
use PHPUnit\Framework\Attributes\DataProvider;

class TypeTest extends TestCase
{
Expand Down Expand Up @@ -72,12 +73,7 @@ public function testBuildFromArray()
$this->assertEquals($calendarControl, $calendarItem);
}

/**
* @dataProvider arrayAssocProvider
*
* @param $array
* @param $expected
*/
#[DataProvider('arrayAssocProvider')]
public function testArrayIsAssoc($array, $expected)
{
$type = $this->getTypeMock();
Expand All @@ -86,9 +82,7 @@ public function testArrayIsAssoc($array, $expected)
$this->assertEquals($expected, $isAssoc);
}

/**
* @dataProvider toStringProvider
*/
#[DataProvider('toStringProvider')]
public function testToString($string, $expected)
{
$type = $this->getTypeMock();
Expand Down
17 changes: 3 additions & 14 deletions tests/src/APITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
namespace garethp\ews\Test;

use garethp\ews\API;
use garethp\ews\API\Type;
use Mockery;
use PHPUnit\Framework\Attributes\DataProvider;
use garethp\ews\API\ExchangeWebServices;
use garethp\ews\API\Enumeration;

Expand Down Expand Up @@ -269,12 +268,7 @@ public function testDeleteItemsFail()
$client->deleteItems($item->toArray(), ['SendMeetingCancellations' => 'SendToNone']);
}

/**
* @dataProvider getFolderByDisplayNameProvider
*
* @param $input
* @param $expected
*/
#[DataProvider('getFolderByDisplayNameProvider')]
public function testGetFolderByDisplayName($input, $expected)
{
$client = $this->getClient();
Expand All @@ -291,12 +285,7 @@ public function testGetFolderByDisplayNameFail()
$this->assertFalse($folder);
}

/**
* Test that the syncFolderItems() function passes the correct arguments to it's client.
*
* @dataProvider listChangesProvider
* @param $folderInput
*/
#[DataProvider('listChangesProvider')]
public function testListItemChanges($folderInput)
{

Expand Down
17 changes: 3 additions & 14 deletions tests/src/CasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,17 @@

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

class CasterTest extends TestCase
{
/**
* @param $input
* @param $type
* @param $expected
*
* @dataProvider castProvider
*/
#[DataProvider('castProvider')]
public function testCast($input, $type, $expected)
{
$this->assertEquals($expected, Caster::cast($input, $type));
}

/**
* @param $from
* @param $to
* @param $expected
*
* @dataProvider castExistsProvider
*/
#[DataProvider('castExistsProvider')]
public function testCastExists($from, $to, $expected)
{
$this->assertEquals($expected, Caster::castExists($from, $to));
Expand Down

0 comments on commit cfd9de6

Please sign in to comment.