Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure compatibility with PHPUnit 12 #119

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/CachePoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

namespace Cache\IntegrationTests;

use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Medium;
use PHPUnit\Framework\TestCase;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
Expand All @@ -35,6 +40,7 @@ abstract public function createCachePool();
/**
* @before
*/
#[Before]
public function setupService()
{
$this->cache = $this->createCachePool();
Expand All @@ -43,6 +49,7 @@ public function setupService()
/**
* @after
*/
#[After]
public function tearDownService()
{
if ($this->cache !== null) {
Expand Down Expand Up @@ -488,6 +495,7 @@ public function testCommit()
/**
* @medium
*/
#[Medium]
public function testExpiration()
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down Expand Up @@ -567,6 +575,7 @@ public function testKeyLength()
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testGetItemInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -580,6 +589,7 @@ public function testGetItemInvalidKeys($key)
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testGetItemsInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -593,6 +603,7 @@ public function testGetItemsInvalidKeys($key)
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testHasItemInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -606,6 +617,7 @@ public function testHasItemInvalidKeys($key)
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testDeleteItemInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -619,6 +631,7 @@ public function testDeleteItemInvalidKeys($key)
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testDeleteItemsInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down Expand Up @@ -857,6 +870,7 @@ public function testSavingObject()
/**
* @medium
*/
#[Medium]
public function testHasItemReturnsFalseWhenDeferredItemIsExpired()
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down
4 changes: 4 additions & 0 deletions src/HierarchicalCachePoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Cache\IntegrationTests;

use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\TestCase;
use Psr\Cache\CacheItemPoolInterface;

Expand All @@ -37,6 +39,7 @@ abstract public function createCachePool();
/**
* @before
*/
#[Before]
public function setupService()
{
$this->cache = $this->createCachePool();
Expand All @@ -45,6 +48,7 @@ public function setupService()
/**
* @after
*/
#[After]
public function tearDownService()
{
if ($this->cache !== null) {
Expand Down
22 changes: 22 additions & 0 deletions src/SimpleCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

namespace Cache\IntegrationTests;

use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Medium;
use PHPUnit\Framework\TestCase;
use Psr\SimpleCache\CacheInterface;

Expand Down Expand Up @@ -49,6 +54,7 @@ public function advanceTime($seconds)
/**
* @before
*/
#[Before]
public function setupService()
{
$this->cache = $this->createSimpleCache();
Expand All @@ -57,6 +63,7 @@ public function setupService()
/**
* @after
*/
#[After]
public function tearDownService()
{
if ($this->cache !== null) {
Expand Down Expand Up @@ -171,6 +178,7 @@ public function testSet()
/**
* @medium
*/
#[Medium]
public function testSetTtl()
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down Expand Up @@ -269,6 +277,7 @@ public function testSetMultipleWithIntegerArrayKey()
/**
* @medium
*/
#[Medium]
public function testSetMultipleTtl()
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down Expand Up @@ -441,6 +450,7 @@ public function testBasicUsageWithLongKey()
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testGetInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -454,6 +464,7 @@ public function testGetInvalidKeys($key)
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testGetMultipleInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -477,6 +488,7 @@ public function testGetMultipleNoIterable()
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testSetInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -490,6 +502,7 @@ public function testSetInvalidKeys($key)
/**
* @dataProvider invalidArrayKeys
*/
#[DataProvider('invalidArrayKeys')]
public function testSetMultipleInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down Expand Up @@ -518,6 +531,7 @@ public function testSetMultipleNoIterable()
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testHasInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -531,6 +545,7 @@ public function testHasInvalidKeys($key)
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testDeleteInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -544,6 +559,7 @@ public function testDeleteInvalidKeys($key)
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testDeleteMultipleInvalidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -567,6 +583,7 @@ public function testDeleteMultipleNoIterable()
/**
* @dataProvider invalidTtl
*/
#[DataProvider('invalidTtl')]
public function testSetInvalidTtl($ttl)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -580,6 +597,7 @@ public function testSetInvalidTtl($ttl)
/**
* @dataProvider invalidTtl
*/
#[DataProvider('invalidTtl')]
public function testSetMultipleInvalidTtl($ttl)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down Expand Up @@ -699,6 +717,7 @@ public function testBinaryData()
/**
* @dataProvider validKeys
*/
#[DataProvider('validKeys')]
public function testSetValidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -712,6 +731,7 @@ public function testSetValidKeys($key)
/**
* @dataProvider validKeys
*/
#[DataProvider('validKeys')]
public function testSetMultipleValidKeys($key)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -732,6 +752,7 @@ public function testSetMultipleValidKeys($key)
/**
* @dataProvider validData
*/
#[DataProvider('validData')]
public function testSetValidData($data)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand All @@ -745,6 +766,7 @@ public function testSetValidData($data)
/**
* @dataProvider validData
*/
#[DataProvider('validData')]
public function testSetMultipleValidData($data)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down
6 changes: 6 additions & 0 deletions src/TaggableCachePoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
namespace Cache\IntegrationTests;

use Cache\TagInterop\TaggableCacheItemPoolInterface;
use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -37,6 +40,7 @@ abstract public function createCachePool();
/**
* @before
*/
#[Before]
public function setupService()
{
$this->cache = $this->createCachePool();
Expand All @@ -45,6 +49,7 @@ public function setupService()
/**
* @after
*/
#[After]
public function tearDownService()
{
if ($this->cache !== null) {
Expand Down Expand Up @@ -133,6 +138,7 @@ public function testTagAccessorWithEmptyTag()
/**
* @dataProvider invalidKeys
*/
#[DataProvider('invalidKeys')]
public function testTagAccessorWithInvalidTag($tag)
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down