コード例 #1
0
ファイル: CommandBaseTest.php プロジェクト: Gradwell/phix
 public function testThrowsExceptionsWhenNotProperlyExtended()
 {
     $obj = new DummyCommand();
     $caughtAssert = false;
     try {
         $obj->getCommandName();
     } catch (\Exception $e) {
         $caughtAssert = true;
     }
     $this->assertTrue($caughtAssert);
     $caughtAssert = false;
     try {
         $obj->getCommandDesc();
     } catch (\Exception $e) {
         $caughtAssert = true;
     }
     $this->assertTrue($caughtAssert);
     $caughtAssert = false;
     try {
         $obj->getValidOptions();
     } catch (\Exception $e) {
         $caughtAssert = true;
     }
     $this->assertTrue($caughtAssert);
     $context = new Context();
     $argv = array();
     $argsIndex = 0;
     $caughtAssert = false;
     try {
         $obj->validateAndExecute($argv, $argsIndex, $context);
     } catch (\Exception $e) {
         $caughtAssert = true;
     }
     $this->assertTrue($caughtAssert);
 }