helloAction() public method

public helloAction ( $params = [] )
コード例 #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");
     });
 }