File modules/util/test/TestCase.class.php
Last commit: Thu Sep 10 23:46:04 2020 +0200 Jan Dankert New: Simple Unit-Testing.
1 <?php 2 3 4 namespace util\test; 5 6 7 class TestCase 8 { 9 public function run() { 10 11 } 12 13 14 protected function assertEquals( $expected,$reality ) 15 { 16 if ( $expected != $reality ) 17 throw new \LogicException("Expected '$expected', but got '$reality'."); 18 } 19 20 protected function assertNotEmpty( $reality ) 21 { 22 if ( empty( $reality ) ) 23 throw new \LogicException("Expected not empty, but got '$reality'."); 24 } 25 26 protected function assertEmpty( $reality ) 27 { 28 if ( !empty( $reality ) ) 29 throw new \LogicException("Expected empty, but got '$reality'."); 30 } 31 32 protected function assertFalse( $reality ) 33 { 34 if ( $reality ) 35 throw new \LogicException("Expected FALSE, but got '$reality'."); 36 } 37 38 protected function assertTrue( $reality ) 39 { 40 if ( ! $reality ) 41 throw new \LogicException("Expected TRUE, but got '$reality'."); 42 } 43 44 protected function fail() 45 { 46 throw new \LogicException("This should not happen."); 47 } 48 }
Downloadmodules/util/test/TestCase.class.php
History Thu, 10 Sep 2020 23:46:04 +0200 Jan Dankert New: Simple Unit-Testing.