Inheritance: extends Phalcon\Cli\Task
コード例 #1
0
ファイル: TasksCliTest.php プロジェクト: racklin/cphalcon
 public function testTasks()
 {
     $di = new \Phalcon\DI\FactoryDefault\CLI();
     $di->set('data', function () {
         return "data";
     });
     $task = new MainTask();
     $task->setDI($di);
     $this->assertEquals($task->requestDiAction(), 'data');
     $this->assertEquals($task->helloAction(), 'Hello !');
     $this->assertEquals($task->helloAction('World'), 'Hello World!');
     $task2 = new EchoTask();
     $task2->setDI($di);
     $this->assertEquals($task2->mainAction(), 'echoMainAction');
 }
コード例 #2
0
ファイル: TasksCliTest.php プロジェクト: mattvb91/cphalcon
 public function testTasks()
 {
     $di = new \Phalcon\DI\FactoryDefault\CLI();
     $di['registry'] = function () {
         $registry = new \Phalcon\Registry();
         $registry->data = 'data';
         return $registry;
     };
     $task = new MainTask();
     $task->setDI($di);
     $this->assertEquals($task->requestRegistryAction(), 'data');
     $this->assertEquals($task->helloAction(), 'Hello !');
     $this->assertEquals($task->helloAction(array('World')), 'Hello World!');
     $task2 = new EchoTask();
     $task2->setDI($di);
     $this->assertEquals($task2->mainAction(), 'echoMainAction');
 }
コード例 #3
0
ファイル: TaskTest.php プロジェクト: phalcon/cphalcon
 public function testTasks()
 {
     $this->specify("CLI Tasks don't return the expected results", function () {
         $di = new CliFactoryDefault();
         $di["registry"] = function () {
             $registry = new Registry();
             $registry->data = "data";
             return $registry;
         };
         $task = new \MainTask();
         $task->setDI($di);
         expect($task->requestRegistryAction())->equals("data");
         expect($task->helloAction())->equals("Hello !");
         expect($task->helloAction(["World"]))->equals("Hello World!");
         $task2 = new \EchoTask();
         $task2->setDI($di);
         expect($task2->mainAction())->equals("echoMainAction");
     });
 }
コード例 #4
0
ファイル: DispatcherTest.php プロジェクト: phalcon/cphalcon
 public function testCallActionMethod()
 {
     $this->specify("CLI Dispatcher's callActionMethod doesn't work as expected", function () {
         $di = new CliFactoryDefault();
         $dispatcher = new Dispatcher();
         $di->setShared("dispatcher", $dispatcher);
         $dispatcher->setDI($di);
         $mainTask = new \MainTask();
         $mainTask->setDI($di);
         expect($dispatcher->callActionMethod($mainTask, 'mainAction', []))->equals('mainAction');
         expect($dispatcher->callActionMethod($mainTask, 'helloAction', ['World']))->equals('Hello World!');
         expect($dispatcher->callActionMethod($mainTask, 'helloAction', ['World', '.']))->equals('Hello World.');
     });
 }
コード例 #5
0
 public function testCallActionMethod()
 {
     $di = new \Phalcon\DI\FactoryDefault\CLI();
     $dispatcher = new \Phalcon\CLI\Dispatcher();
     $di->setShared("dispatcher", $dispatcher);
     $dispatcher->setDI($di);
     $mainTask = new MainTask();
     $mainTask->setDI($di);
     $this->assertEquals($dispatcher->callActionMethod($mainTask, 'mainAction', []), 'mainAction');
     $this->assertEquals($dispatcher->callActionMethod($mainTask, 'helloAction', ['World']), 'Hello World!');
     $this->assertEquals($dispatcher->callActionMethod($mainTask, 'helloAction', ['World', '.']), 'Hello World.');
 }