mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-03 01:25:21 +02:00
refactor (#3712)
* test: refactor test suite * docs * refactor * yup * docs
This commit is contained in:
parent
0c92cf32d4
commit
41df17bc46
23 changed files with 309 additions and 566 deletions
36
tests/CacheImplementationTest.php
Normal file
36
tests/CacheImplementationTest.php
Normal file
|
@ -0,0 +1,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');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue