blob: e6ed352ba9eb315941e9fd59d9889660223a62b5 (
plain) (
blame)
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
|
<?php
namespace RssBridge\Tests;
use CacheInterface;
use PHPUnit\Framework\TestCase;
class CacheImplementationTest extends TestCase
{
public function getCacheClassNames()
{
$caches = [];
foreach (glob(PATH_LIB_CACHES . '*.php') as $path) {
$caches[] = [basename($path, '.php')];
}
return $caches;
}
/**
* @dataProvider getCacheClassNames
*/
public function testClassName($path)
{
$this->assertTrue($path === ucfirst($path), 'class name must start with uppercase character');
$this->assertEquals(0, substr_count($path, ' '), 'class name must not contain spaces');
$this->assertStringEndsWith('Cache', $path, 'class name must end with "Cache"');
}
/**
* @dataProvider getCacheClassNames
*/
public function testClassType($path)
{
$this->assertTrue(is_subclass_of($path, CacheInterface::class), 'class must be subclass of CacheInterface');
}
}
|