Skip to content

Commit

Permalink
Upgrade to PHPUnit 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
benmatselby committed Feb 3, 2024
1 parent 7d8a142 commit de03641
Show file tree
Hide file tree
Showing 17 changed files with 265 additions and 369 deletions.
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":{"TrelloCli\\Test\\ClientTest::testThatGetBoardsCallsTheBoardsEndPointForMe":5,"TrelloCli\\Test\\ClientTest::testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches#Standard name check":5,"TrelloCli\\Test\\ClientTest::testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches#Casing changes, but board returned":5,"TrelloCli\\Test\\ClientTest::testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches#No match":5},"times":{"TrelloCli\\Test\\ClientTest::testThatGetBoardsCallsTheBoardsEndPointForMe":0.007,"TrelloCli\\Test\\ClientTest::testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches#Standard name check":0,"TrelloCli\\Test\\ClientTest::testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches#Casing changes, but board returned":0,"TrelloCli\\Test\\ClientTest::testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches#No match":0,"TrelloCli\\Test\\ClientTest::testThatGetCardsCallsTheBoardsEndPointGivenTheBoardId":0,"TrelloCli\\Test\\ClientTest::testThatGetCardChecklistCallsTheCardChecklistEndPointWithCardId":0,"TrelloCli\\Test\\ClientTest::testThatGetCardActionsCallsTheCardActionsEndPointWithCardId":0,"TrelloCli\\Test\\ClientTest::testThatGetCardMembersCallsTheCardMembersEndPointWithCardId":0,"TrelloCli\\Test\\ClientTest::testThatGetListsCallsTheBoardsEndPointGivenTheBoardId":0,"TrelloCli\\Test\\ClientTest::testThatGetMeberCallsTheMembersEndPointGivenTheMeberId":0,"TrelloCli\\Test\\ClientTest::testGetHttpClient":0.002,"TrelloCli\\Test\\Command\\BurndownCommandTest::testConfigure":0.001,"TrelloCli\\Test\\Command\\JsonExportBoardCommandTest::testConfigure":0,"TrelloCli\\Test\\Command\\LabelCardsCommandTest::testConfigure":0,"TrelloCli\\Test\\Command\\ListBoardsCommandTest::testConfigure":0,"TrelloCli\\Test\\Command\\ListBoardsCommandTest::testExecuteCanRenderWhatWeWant":0.001,"TrelloCli\\Test\\Command\\ListCardsCommandTest::testConfigure":0,"TrelloCli\\Test\\Command\\ListPeopleCommandTest::testConfigure":0,"TrelloCli\\Test\\Command\\SortCommandTest::testConfigure":0,"TrelloCli\\Test\\Config\\AdapterTest::testTheDefaultIsEnvironment":0,"TrelloCli\\Test\\Config\\AdapterTest::testTheDefaultIsAnEmptyConfigFile":0,"TrelloCli\\Test\\Config\\EnvironmentTest::testWeCanGetConfigFromTheEnvironment":0,"TrelloCli\\Test\\ConfigTest::testSettersAndGetters":0,"TrelloCli\\Test\\Filter\\IgnoreLabelTest::testWeCanFilterCardsIfTheyHaveACertainLabel":0,"TrelloCli\\Test\\Filter\\LabelTest::testWeCanFilterCardsIfTheyHaveACertainLabel":0,"TrelloCli\\Test\\Sorter\\DateCreatedTest::testWeOrderByDateCreated":0}}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"guzzlehttp/guzzle": "7.7.*"
},
"require-dev": {
"phpunit/phpunit": "^10",
"phpunit/phpunit": "^11",
"phpstan/phpstan": "^1.2",
"squizlabs/php_codesniffer": "^3.5"
},
Expand Down
453 changes: 231 additions & 222 deletions composer.lock

Large diffs are not rendered by default.

51 changes: 6 additions & 45 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

namespace TrelloCli\Test;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use GuzzleHttp\Psr7\Stream;
use PHPUnit\Framework\Attributes\DataProvider;
use TrelloCli\Client;
use TrelloCli\Config\Adapter;

/**
* Trello Client Test Class
*
* Responsible for testing \TrelloCli\Client
*/
class ClientTest extends \PHPUnit\Framework\TestCase
#[CoversClass(Client::class)]
class ClientTest extends TestCase
{
/**
* @inheritdoc
Expand All @@ -34,10 +33,6 @@ protected function getResource(string $value): mixed
return $resource;
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getBoards
*/
public function testThatGetBoardsCallsTheBoardsEndPointForMe(): void
{
$response = $this->createMock('\Psr\Http\Message\ResponseInterface');
Expand All @@ -63,12 +58,9 @@ public function testThatGetBoardsCallsTheBoardsEndPointForMe(): void
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getBoardByName
* @dataProvider provideDataForBoardByName
*
* @param array<string,string> $expected The expected boards
*/
#[DataProvider('provideDataForBoardByName')]
public function testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches(
string $boardName,
string $boards,
Expand Down Expand Up @@ -96,8 +88,6 @@ public function testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches(
}

/**
* Data provider for testThatGetBoardByNameCallsReturnsTheBoardIfTheNameMatches
*
* @return array<string,mixed>
*/
public static function provideDataForBoardByName(): array
Expand All @@ -123,10 +113,6 @@ public static function provideDataForBoardByName(): array
];
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getCards
*/
public function testThatGetCardsCallsTheBoardsEndPointGivenTheBoardId(): void
{
$response = $this->createMock('\Psr\Http\Message\ResponseInterface');
Expand All @@ -150,10 +136,6 @@ public function testThatGetCardsCallsTheBoardsEndPointGivenTheBoardId(): void
$this->assertEquals(['card'], $result);
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getCardChecklist
*/
public function testThatGetCardChecklistCallsTheCardChecklistEndPointWithCardId(): void
{
$response = $this->createMock('\Psr\Http\Message\ResponseInterface');
Expand All @@ -176,10 +158,6 @@ public function testThatGetCardChecklistCallsTheCardChecklistEndPointWithCardId(
$this->assertEquals(['card'], $result);
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getCardActions
*/
public function testThatGetCardActionsCallsTheCardActionsEndPointWithCardId(): void
{
$response = $this->createMock('\Psr\Http\Message\ResponseInterface');
Expand All @@ -202,10 +180,6 @@ public function testThatGetCardActionsCallsTheCardActionsEndPointWithCardId(): v
$this->assertEquals(['card'], $result);
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getCardMembers
*/
public function testThatGetCardMembersCallsTheCardMembersEndPointWithCardId(): void
{
$response = $this->createMock('\Psr\Http\Message\ResponseInterface');
Expand All @@ -228,10 +202,6 @@ public function testThatGetCardMembersCallsTheCardMembersEndPointWithCardId(): v
$this->assertEquals(['card'], $result);
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getLists
*/
public function testThatGetListsCallsTheBoardsEndPointGivenTheBoardId(): void
{
$response = $this->createMock('\Psr\Http\Message\ResponseInterface');
Expand All @@ -254,10 +224,6 @@ public function testThatGetListsCallsTheBoardsEndPointGivenTheBoardId(): void
$this->assertEquals(['list'], $result);
}

/**
* @covers \TrelloCli\Client::__construct
* @covers \TrelloCli\Client::getMember
*/
public function testThatGetMeberCallsTheMembersEndPointGivenTheMeberId(): void
{
$response = $this->createMock('\Psr\Http\Message\ResponseInterface');
Expand All @@ -280,11 +246,6 @@ public function testThatGetMeberCallsTheMembersEndPointGivenTheMeberId(): void
$this->assertEquals(['member'], $result);
}

/**
* @covers \TrelloCli\Client::instance
* @covers \TrelloCli\Client::resetInstance
* @covers \TrelloCli\Client::getHttpClient
*/
public function testGetHttpClient(): void
{
putenv("TRELLO_CLI_KEY=key");
Expand Down
9 changes: 2 additions & 7 deletions tests/Command/BurndownCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

namespace TrelloCli\Test\Command;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Command\BurndownCommand;
use TrelloCli\Client;

/**
* Responsible for testing \TrelloCli\Command\BurndownCommand
*/
#[CoversClass(BurndownCommand::class)]
class BurndownCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Command\BurndownCommand::configure
*/
public function testConfigure(): void
{
$trello = $this->createMock('\TrelloCli\Client');
Expand Down
9 changes: 2 additions & 7 deletions tests/Command/JsonExportBoardCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

namespace TrelloCli\Test\Command;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Command\JsonExportBoardCommand;
use TrelloCli\Client;

/**
* Responsible for testing \TrelloCli\Command\JsonExportBoardCommand
*/
#[CoversClass(JsonExportBoardCommand::class)]
class JsonExportBoardCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Command\JsonExportBoardCommand::configure
*/
public function testConfigure(): void
{
$trello = $this->createMock('\TrelloCli\Client');
Expand Down
9 changes: 2 additions & 7 deletions tests/Command/LabelCardsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

namespace TrelloCli\Test\Command;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Command\LabelCardsCommand;
use TrelloCli\Client;

/**
* Responsible for testing \TrelloCli\Command\LabelCardsCommand
*/
#[CoversClass(LabelCardsCommand::class)]
class LabelCardsCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Command\LabelCardsCommand::configure
*/
public function testConfigure(): void
{
$trello = $this->createMock('\TrelloCli\Client');
Expand Down
11 changes: 2 additions & 9 deletions tests/Command/ListBoardsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

namespace TrelloCli\Test\Command;

use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Console\Tester\CommandTester;
use TrelloCli\Command\ListBoardsCommand;

/**
* Responsible for testing \TrelloCli\Command\ListBoardsCommand
*/
#[CoversClass(ListBoardsCommand::class)]
class ListBoardsCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Command\ListBoardsCommand::configure
*/
public function testConfigure(): void
{
$trello = $this->createMock('\TrelloCli\Client');
Expand All @@ -26,9 +22,6 @@ public function testConfigure(): void
);
}

/**
* @covers \TrelloCli\Command\ListBoardsCommand::execute
*/
public function testExecuteCanRenderWhatWeWant(): void
{
$client = $this->createMock('\TrelloCli\Client');
Expand Down
9 changes: 2 additions & 7 deletions tests/Command/ListCardsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

namespace TrelloCli\Test\Command;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Command\ListCardsCommand;
use TrelloCli\Client;

/**
* Responsible for testing \TrelloCli\Command\ListCardsCommand
*/
#[CoversClass(ListCardsCommand::class)]
class ListCardsCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Command\ListCardsCommand::configure
*/
public function testConfigure(): void
{
$trello = $this->createMock('\TrelloCli\Client');
Expand Down
9 changes: 2 additions & 7 deletions tests/Command/ListPeopleCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

namespace TrelloCli\Test\Command;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Command\ListPeopleCommand;
use TrelloCli\Client;

/**
* Responsible for testing \TrelloCli\Command\ListPeopleCommand
*/
#[CoversClass(ListPeopleCommand::class)]
class ListPeopleCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Command\ListPeopleCommand::configure
*/
public function testConfigure(): void
{
$trello = $this->createMock('\TrelloCli\Client');
Expand Down
9 changes: 2 additions & 7 deletions tests/Command/SortCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

namespace TrelloCli\Test\Command;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Command\SortCommand;
use TrelloCli\Client;

/**
* Responsible for testing \TrelloCli\Command\SortCommand
*/
#[CoversClass(SortCommand::class)]
class SortCommandTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Command\SortCommand::configure
*/
public function testConfigure(): void
{
$trello = $this->createMock('\TrelloCli\Client');
Expand Down
11 changes: 2 additions & 9 deletions tests/Config/AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace TrelloCli\Test\Config;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Config\Adapter;

/**
* Responsible for testing \TrelloCli\Config\Adapter
*/
#[CoversClass(Adapter::class)]
class AdapterTest extends \PHPUnit\Framework\TestCase
{
/**
Expand All @@ -18,9 +17,6 @@ public function tearDown(): void
putenv("TRELLO_CLI_SECRET");
}

/**
* @covers \TrelloCli\Config\Adapter::getConfig
*/
public function testTheDefaultIsEnvironment(): void
{
putenv("TRELLO_CLI_KEY=key");
Expand All @@ -32,9 +28,6 @@ public function testTheDefaultIsEnvironment(): void
$this->assertEquals($config->getSecret(), "secret");
}

/**
* @covers \TrelloCli\Config\Adapter::getConfig
*/
public function testTheDefaultIsAnEmptyConfigFile(): void
{
$config = Adapter::getConfig();
Expand Down
10 changes: 2 additions & 8 deletions tests/Config/EnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

namespace TrelloCli\Test\Config;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Config\Environment;

/**
* Trello Config Environment Test Class
*
* Responsible for testing \TrelloCli\Config\Environment
*/
#[CoversClass(Environment::class)]
class EnvironmentTest extends \PHPUnit\Framework\TestCase
{
/**
Expand All @@ -20,9 +17,6 @@ public function tearDown(): void
putenv('TRELLO_CLI_SECRET');
}

/**
* @covers \TrelloCli\Config\Environment::build
*/
public function testWeCanGetConfigFromTheEnvironment(): void
{
putenv('TRELLO_CLI_KEY=my-key-env');
Expand Down
15 changes: 2 additions & 13 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@

namespace TrelloCli\Test;

use PHPUnit\Framework\Attributes\CoversClass;
use TrelloCli\Config;

/**
* Trello Config Test Class
*
* Responsible for testing \TrelloCli\Config
*/
#[CoversClass(Config::class)]
class ConfigTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \TrelloCli\Config::setSecret
* @covers \TrelloCli\Config::getSecret
* @covers \TrelloCli\Config::setKey
* @covers \TrelloCli\Config::getKey
* @covers \TrelloCli\Config::isValid
* @covers \TrelloCli\Config::setValid
*/
public function testSettersAndGetters(): void
{
$config = new Config();
Expand Down
Loading

0 comments on commit de03641

Please sign in to comment.