forked from neos/flow-development-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbstractBackendTest.php
68 lines (62 loc) · 2.26 KB
/
AbstractBackendTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
namespace Neos\Cache\Tests\Unit\Backend;
include_once(__DIR__ . '/../../BaseTestCase.php');
/*
* This file is part of the Neos.Cache package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
use Neos\Cache\Backend\AbstractBackend;
use Neos\Cache\EnvironmentConfiguration;
use Neos\Cache\Tests\BaseTestCase;
/**
* Testcase for the abstract cache backend
*
*/
class AbstractBackendTest extends BaseTestCase
{
/**
* @var AbstractBackend
*/
protected $backend;
/**
* @return void
*/
protected function setUp(): void
{
class_exists(AbstractBackend::class);
$className = 'ConcreteBackend_' . md5(uniqid(mt_rand(), true));
eval('
class ' . $className . ' extends \Neos\Cache\Backend\AbstractBackend {
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = NULL) {}
public function get(string $entryIdentifier): string {}
public function has(string $entryIdentifier): bool {}
public function remove(string $entryIdentifier): bool {}
public function flush() {}
public function flushByTag(string $tag): int {}
public function findIdentifiersByTag(string $tag): array {}
public function collectGarbage() {}
public function setSomeOption($value) {
$this->someOption = $value;
}
public function getSomeOption() {
return $this->someOption;
}
}
');
$this->backend = new $className(new EnvironmentConfiguration('Ultraman Neos Testing', '/some/path', PHP_MAXPATHLEN));
}
/**
* @test
*/
public function theConstructorCallsSetterMethodsForAllSpecifiedOptions()
{
$className = get_class($this->backend);
$backend = new $className(new EnvironmentConfiguration('Ultraman Neos Testing', '/some/path', PHP_MAXPATHLEN), ['someOption' => 'someValue']);
$this->assertSame('someValue', $backend->getSomeOption());
}
}