File modules/util/test/ClassNameTest.class.php
Last commit: Tue Nov 17 23:51:00 2020 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.
1 <?php 2 3 namespace util\test; 4 5 use util\ClassName; 6 use util\YAML; 7 8 class ClassNameTest extends TestCase { 9 10 public function testShortName() 11 { 12 $classname = new ClassName( 'cms\action\page\PageShowAction'); 13 14 $this->assertEquals( 'PageShowAction',$classname->dropNamespace()->get() ); 15 $this->assertEquals( 'PageShow',$classname->dropSuffix('Action')->get() ); 16 } 17 18 19 public function testParent() 20 { 21 $classname = (new ClassName( 'PageShowAction'))->addNamespace(['cms','action','page']); 22 23 $this->assertEquals( true,$classname->getParent()->exists() ); 24 $this->assertEquals( 'cms\action\PageAction',$classname->get() ); 25 $this->assertEquals( true,$classname->getParent()->exists() ); 26 $this->assertEquals( 'cms\action\ObjectAction',$classname->get() ); 27 $this->assertEquals( true,$classname->getParent()->exists() ); 28 $this->assertEquals( 'cms\action\BaseAction',$classname->get() ); 29 $this->assertEquals( true,$classname->getParent()->exists() ); 30 $this->assertEquals( 'cms\action\Action',$classname->get() ); 31 $this->assertEquals( false,$classname->getParent()->exists() ); 32 $this->assertEquals( false,$classname->get() ); 33 } 34 } 35 36 37
Downloadmodules/util/test/ClassNameTest.class.php
History Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.