예제 #1
0
 public function testStartNormal()
 {
     try {
         $_GET["cmd"] = "";
         //启动程序
         PHPCbping::start();
         $this->assertEquals("default.default", file_get_contents(APPPATH . "/temp/testForCmd.text"));
         $_GET["cmd"] = "test.testCore";
         PHPCbping::start();
         $this->assertEquals("test.test", file_get_contents(APPPATH . "/temp/testForCmd.text"));
         //输出异常
         $_GET["cmd"] = "test.testCore";
         $_GET["exc"] = "echo_exc";
         PHPCbping::start();
         $this->assertEquals("echo_exc", file_get_contents(APPPATH . "/temp/testForCmd.text"));
         //一般异常
         $_GET["cmd"] = "test.testCore";
         $_GET["exc"] = "exc";
         PHPCbping::start();
         $this->assertEquals("exc", file_get_contents(APPPATH . "/temp/testForCmd.text"));
         $_GET["cmd"] = "noHaveCore";
         PHPCbping::start();
         $_GET["cmd"] = "NocmdCore";
         PHPCbping::start();
         $_GET["cmd"] = "NoClassExistCore";
         PHPCbping::start();
         //测试控制过滤
         AppHelper::Instance()->config("CMD_FILTER", '/ControllerCore$/');
         $_GET["cmd"] = "DefaultControllerCore";
         PHPCbping::start();
         $this->assertEquals("default.default", file_get_contents(APPPATH . "/temp/testForCmd.text"));
     } catch (Exception $e) {
         log_message(LOG_ERR, $e->getMessage());
         echo $e->getMessage();
         $this->assertEquals(false, true);
     }
 }
예제 #2
0
파일: index.php 프로젝트: BPing/PHPCbping
<?php

require_once 'PHPCbping/PHPCbping.class.php';
//启动程序
PHPCbping::start();