Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8e17838
TASK: Update required PHPUnit ^9.1 to ^11.5
kdambekalns Dec 9, 2025
da22e9c
TASK: Update required vfsstream ^1.16.10 to ^1.16.12
kdambekalns Dec 9, 2025
8c0084a
TASK: Update tests for PHPUnit 9
kdambekalns Dec 9, 2025
48e32a1
TASK: Update tests for PHPUnit 10
kdambekalns Dec 9, 2025
26b8b11
TASK: Drop overridden constructor for TestCase
kdambekalns Dec 9, 2025
d8a5c4c
TASK: Use onlyMethods and willReturn in PHPUnit tests
kitsunet Nov 5, 2024
1ab52a3
TASK: Adjust dataProviders to be static
kdambekalns Dec 9, 2025
123ebef
TASK: Fix some dynamic property assignments
kdambekalns Oct 25, 2024
3798a57
TASK: Delete empty test case that probably never will filled
kdambekalns Nov 19, 2024
ee46e39
TASK: Add "test property" to ConfigurationManager
kdambekalns Oct 25, 2024
343dd27
TASK: Fix dynamic property assignments
kdambekalns Oct 25, 2024
0826ef5
TASK: Adjust mock building using anonymous class
kdambekalns Oct 25, 2024
033b85c
TASK: Adjust dataProviders to be static
kdambekalns Nov 19, 2024
ab7ee2a
TASK: Add return types
kdambekalns May 27, 2026
3623f32
TASK: Replace getInvocationCount() with numberOfInvocations()
kdambekalns May 27, 2026
640f5d8
TASK: Various test fixes
kdambekalns May 27, 2026
40f7365
TASK: Apply Rector fixes
kdambekalns May 27, 2026
f3bba5c
TASK: Apply Rector fixes
kdambekalns May 27, 2026
88a5628
TASK: Apply Rector fixes
kdambekalns May 27, 2026
649e2da
TASK: Apply Rector fixes
kdambekalns May 27, 2026
695aa43
BUGFIX: uniqid() expects a string, add type cast
kdambekalns May 27, 2026
5627ea5
BUGFIX: Pass array as expected
kdambekalns May 27, 2026
86a3b63
TASK: Switch from annotations to attributes in tests
kdambekalns May 29, 2026
046c4c2
TASK: Adjust data providers to be static
kdambekalns May 29, 2026
0cc2c24
TASK: Replace changed assertions and checks
kdambekalns May 29, 2026
0737565
TASK: Fix some type errors
kdambekalns May 29, 2026
14c24fe
TASK: Fix some failing tests
kdambekalns May 29, 2026
484acf5
TASK: addMethods() in place of addMethods()
kdambekalns May 29, 2026
dfe2f70
TASK: Fix setUp() in ViewHelperBaseTestcase
kdambekalns May 29, 2026
fedd2aa
TASK: Fix test missing an added method
kdambekalns May 29, 2026
27eea1a
TASK: Fix deprecated Test suffix on abstract test base class
kdambekalns May 29, 2026
802dec3
TASK: Fix warning about a warning
kdambekalns May 29, 2026
8833536
TASK: Fix undefined variables in closure
kdambekalns May 29, 2026
c5a3ed2
!!! TASK: Change `getAccessibleMock()` signature
kdambekalns May 29, 2026
b8afe36
TASK: Fix remaining unit test failures
kdambekalns May 29, 2026
21384ec
TASK: Adjust getName to name()
kdambekalns May 29, 2026
b666156
TASK: Adjust "large group" attribute
kdambekalns May 29, 2026
439c65d
TASK: Fix remaining functional test failures
kdambekalns May 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 6 additions & 2 deletions Neos.Cache/Tests/BaseTestCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php

declare(strict_types=1);

namespace Neos\Cache\Tests;

use PHPUnit\Framework\TestCase;

/*
* This file is part of the Neos.Cache package.
*
Expand All @@ -10,12 +15,11 @@
* information, please view the LICENSE file which was distributed with this
* source code.
*/

/**
* The mother of all test cases.
*
*/
abstract class BaseTestCase extends \PHPUnit\Framework\TestCase
abstract class BaseTestCase extends TestCase
{
/**
* @var array
Expand Down
103 changes: 50 additions & 53 deletions Neos.Cache/Tests/Functional/Backend/PdoBackendTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php

declare(strict_types=1);

namespace Neos\Cache\Tests\Functional\Backend;

use PHPUnit\Framework\Attributes\RequiresPhpExtension;

include_once(__DIR__ . '/../../BaseTestCase.php');

/*
Expand All @@ -18,27 +23,32 @@
use Neos\Cache\EnvironmentConfiguration;
use Neos\Cache\Tests\BaseTestCase;
use Neos\Cache\Frontend\FrontendInterface;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;

/**
* Testcase for the PDO cache backend
*
* These tests use actual database servers and will place and remove keys in the db!
* Since all keys have the 'TestCache:' prefix, running the tests should have
* no side effects on non-related cache entries.
*
* @requires extension pdo
*/
class PdoBackendTest extends BaseTestCase
#[RequiresPhpExtension('pdo')]
final class PdoBackendTest extends BaseTestCase
{
/**
* @var PdoBackend[]
*/
private $backends = [];
private array $backends = [];

/**
* @var \PHPUnit\Framework\MockObject\MockObject|FrontendInterface
*/
private $cache;
private FrontendInterface|MockObject $cache;

protected function setUp(): void
{
$this->cache = $this->createMock(FrontendInterface::class);
$this->cache->method('getIdentifier')->willReturn('TestCache');
$this->setupBackends();
}

protected function tearDown(): void
{
Expand All @@ -47,49 +57,39 @@ protected function tearDown(): void
}
}

public function backendsToTest(): array
#[Test]
public function setAddsCacheEntry(): void
{
$this->cache = $this->createMock(FrontendInterface::class);
$this->cache->method('getIdentifier')->willReturn('TestCache');
$this->setupBackends();
return $this->backends;
foreach ($this->backends as $backend) {
$backend->flush();

// use data that contains binary junk
$data = random_bytes(2048);
$backend->set('some_entry', $data);
self::assertEquals($data, $backend->get('some_entry'));
}
}

/**
* @test
* @dataProvider backendsToTest
*/
public function setAddsCacheEntry(BackendInterface $backend): void
#[Test]
public function cacheEntriesCanBeIterated(): void
{
$backend->flush();
foreach ($this->backends as $backend) {
$backend->flush();

// use data that contains binary junk
$data = random_bytes(2048);
$backend->set('some_entry', $data);
self::assertEquals($data, $backend->get('some_entry'));
}
// use data that contains binary junk
$data = random_bytes(128);
$backend->set('first_entry', $data);
$backend->set('second_entry', $data);
$backend->set('third_entry', $data);

/**
* @test
* @dataProvider backendsToTest
*/
public function cacheEntriesCanBeIterated(BackendInterface $backend): void
{
$backend->flush();

// use data that contains binary junk
$data = random_bytes(128);
$backend->set('first_entry', $data);
$backend->set('second_entry', $data);
$backend->set('third_entry', $data);

$entries = 0;
foreach ($backend as $entry) {
self::assertEquals($data, $entry);
$entries++;
}
$entries = 0;
foreach ($backend as $entry) {
self::assertEquals($data, $entry);
$entries++;
}

self::assertEquals(3, $entries);
self::assertSame(3, $entries);
}
}

private function setupBackends(): void
Expand All @@ -105,9 +105,8 @@ private function setupBackends(): void
$backend->setup();
$backend->setCache($this->cache);
$backend->flush();
$this->backends['sqlite'] = [$backend];
} catch (\Throwable $t) {
$this->addWarning('SQLite DB is not reachable: ' . $t->getMessage());
$this->backends['sqlite'] = $backend;
} catch (\Throwable) {
}

try {
Expand All @@ -123,9 +122,8 @@ private function setupBackends(): void
$backend->setup();
$backend->setCache($this->cache);
$backend->flush();
$this->backends['mysql'] = [$backend];
} catch (\Throwable $t) {
$this->addWarning('MySQL DB server is not reachable: ' . $t->getMessage());
$this->backends['mysql'] = $backend;
} catch (\Throwable) {
}

try {
Expand All @@ -141,9 +139,8 @@ private function setupBackends(): void
$backend->setup();
$backend->setCache($this->cache);
$backend->flush();
$this->backends['pgsql'] = [$backend];
} catch (\Throwable $t) {
$this->addWarning('PostgreSQL DB server is not reachable: ' . $t->getMessage());
$this->backends['pgsql'] = $backend;
} catch (\Throwable) {
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?php

declare(strict_types=1);

namespace Neos\Cache\Tests\Functional\Backend;

use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\Attributes\Test;

include_once(__DIR__ . '/../../BaseTestCase.php');

/*
Expand Down Expand Up @@ -36,10 +41,9 @@
* The users can be added by:
* acl setuser test_no_password on > ~* &* +@all
* acl setuser test_password on >secret_password ~* &* +@all
*
* @requires extension redis
*/
class RedisBackendAuthenticationTest extends BaseTestCase
#[RequiresPhpExtension('redis')]
final class RedisBackendAuthenticationTest extends BaseTestCase
{
/**
* @var Redis|null
Expand Down Expand Up @@ -104,9 +108,7 @@ protected function setUp(): void
}
}

/**
* @test
*/
#[Test]
public function defaultUserNoPassword()
{
$backend = new RedisBackend(
Expand All @@ -116,9 +118,7 @@ public function defaultUserNoPassword()
$this->assertInstanceOf('Neos\Cache\Backend\RedisBackend', $backend);
}

/**
* @test
*/
#[Test]
public function usernameNoPassword()
{
$backend = new RedisBackend(
Expand All @@ -128,9 +128,7 @@ public function usernameNoPassword()
$this->assertInstanceOf('Neos\Cache\Backend\RedisBackend', $backend);
}

/**
* @test
*/
#[Test]
public function usernamePassword()
{
$backend = new RedisBackend(
Expand All @@ -140,9 +138,7 @@ public function usernamePassword()
$this->assertInstanceOf('Neos\Cache\Backend\RedisBackend', $backend);
}

/**
* @test
*/
#[Test]
public function incorrectUsernamePassword()
{
$this->expectException(RedisException::class);
Expand Down
Loading
Loading