colly
2017-07-26 c1236314ef1122e14edd46c9fe4102fc16e2ce46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
 * PhpUnderControl_PhalApiHelperTestRunner_Test
 *
 * 针对 ../PhalApi/Helper/TestRunner.php PhalApi_Helper_TestRunner 类的PHPUnit单元测试
 *
 * @author: dogstar 20170415
 */
 
require_once dirname(__FILE__) . '/../test_env.php';
 
if (!class_exists('PhalApi_Helper_TestRunner')) {
    require dirname(__FILE__) . '/../../PhalApi/Helper/TestRunner.php';
}
 
class PhpUnderControl_PhalApiHelperTestRunner_Test extends PHPUnit_Framework_TestCase
{
    public $phalApiHelperTestRunner;
 
    protected function setUp()
    {
        parent::setUp();
 
        $this->phalApiHelperTestRunner = new PhalApi_Helper_TestRunner();
    }
 
    protected function tearDown()
    {
    }
 
 
    /**
     * @group testGo
     */ 
    public function testGo()
    {
        $url = 'demo.phalapi.net';
        $params = array (
            'service' => 'InnerRunner.Go',
        );
 
        $rs = PhalApi_Helper_TestRunner::go($url, $params);
 
        $this->assertTrue(is_array($rs));
    }
 
    /**
     * @expectedException PhalApi_Exception
     */
    public function testGoWrong()
    {
        PhalApi_Helper_TestRunner::go('', array());
    }
}
 
class APi_InnerRunner extends PhalApi_Api {
 
    public function go() {
        return array('home');
    }
}