diff options
author | 2023-09-21 22:05:55 +0200 | |
---|---|---|
committer | 2023-09-21 22:05:55 +0200 | |
commit | 7329b83cc0fe1a5f707f864b1f3d62efd4be2172 (patch) | |
tree | 6e0a241fb8bac65b6f06327453f48ed75d2cdbf7 /tests/Actions/ActionImplementationTest.php | |
parent | 360f953be82b7340bd153991bdc87f699db598a4 (diff) | |
download | rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.tar.gz rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.tar.zst rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.zip |
refactor: logger (#3678)
Diffstat (limited to 'tests/Actions/ActionImplementationTest.php')
-rw-r--r-- | tests/Actions/ActionImplementationTest.php | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/tests/Actions/ActionImplementationTest.php b/tests/Actions/ActionImplementationTest.php deleted file mode 100644 index e70dd7e2..00000000 --- a/tests/Actions/ActionImplementationTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -namespace RssBridge\Tests\Actions; - -use ActionInterface; -use PHPUnit\Framework\TestCase; - -class ActionImplementationTest extends TestCase -{ - private $class; - private $obj; - - public function setUp(): void - { - \Configuration::loadConfiguration(); - } - - /** - * @dataProvider dataActionsProvider - */ - public function testClassName($path) - { - $this->setAction($path); - $this->assertTrue($this->class === ucfirst($this->class), 'class name must start with uppercase character'); - $this->assertEquals(0, substr_count($this->class, ' '), 'class name must not contain spaces'); - $this->assertStringEndsWith('Action', $this->class, 'class name must end with "Action"'); - } - - /** - * @dataProvider dataActionsProvider - */ - public function testClassType($path) - { - $this->setAction($path); - $this->assertInstanceOf(ActionInterface::class, $this->obj); - } - - /** - * @dataProvider dataActionsProvider - */ - public function testVisibleMethods($path) - { - $allowedMethods = get_class_methods(ActionInterface::class); - sort($allowedMethods); - - $this->setAction($path); - - $methods = array_diff(get_class_methods($this->obj), ['__construct']); - sort($methods); - - $this->assertEquals($allowedMethods, $methods); - } - - public function dataActionsProvider() - { - $actions = []; - foreach (glob(PATH_LIB_ACTIONS . '*.php') as $path) { - $actions[basename($path, '.php')] = [$path]; - } - return $actions; - } - - private function setAction($path) - { - $this->class = '\\' . basename($path, '.php'); - $this->assertTrue(class_exists($this->class), 'class ' . $this->class . ' doesn\'t exist'); - $this->obj = new $this->class(); - } -} |