Пример #1
0
 public function testRun()
 {
     $sut = new Run();
     $sut->setScripts(array('printf "Hello "', 'echo "World!"'));
     $sut->run();
     $this->expectOutputString("Hello World!\n");
 }
Пример #2
0
    {
        $methodName = 'api';
        foreach ($method as $name) {
            $methodName .= ucfirst($name);
        }
        return $methodName;
    }
    /**
     * Run test method
     */
    public function run()
    {
        try {
            $method = $this->_validateMethodName();
            /**
             * Example
             *
             * $this->_api->product()->apiList()
             * $this->_api->order()->apiAdd()
             */
            $result = call_user_func(array(call_user_func(array($this->_api, $method['section'])), $method['method']), TestData::data($method));
            //View result
            var_dump($result);
        } catch (Exception $e) {
            echo "#" . $e->getCode() . " " . $e->getMessage() . "\n";
        }
    }
}
$run = new Run();
$run->run();
Пример #3
0
 public function testWillAttemptToRunDefaultTaskIfNoneIsSpecified()
 {
     $classMap = new ClassMap();
     $classMap->register('dummy', '\\Gasp\\Task\\Dummy');
     $run = new Run($classMap);
     $run->task('default', 'dummy');
     $serverVars = array('argv' => array());
     $run->setServerVars($serverVars);
     ob_start();
     $run->run();
     $this->assertContains('DUMMY_TASK', ob_get_clean());
 }