aboutsummaryrefslogtreecommitdiff
path: root/tests/CacheImplementationTest.php
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2023-10-01 19:23:30 +0200
committerGravatar GitHub <noreply@github.com> 2023-10-01 19:23:30 +0200
commit41df17bc464832118a767ceff6c9217071699783 (patch)
tree43710b61bd28ce068d06ce057c5d301dee11d189 /tests/CacheImplementationTest.php
parent0c92cf32d471cc0722727b7cd40779882f7b923a (diff)
downloadrss-bridge-41df17bc464832118a767ceff6c9217071699783.tar.gz
rss-bridge-41df17bc464832118a767ceff6c9217071699783.tar.zst
rss-bridge-41df17bc464832118a767ceff6c9217071699783.zip
refactor (#3712)
* test: refactor test suite * docs * refactor * yup * docs
Diffstat (limited to 'tests/CacheImplementationTest.php')
-rw-r--r--tests/CacheImplementationTest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/CacheImplementationTest.php b/tests/CacheImplementationTest.php
new file mode 100644
index 00000000..e6ed352b
--- /dev/null
+++ b/tests/CacheImplementationTest.php
@@ -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');
+ }
+}