mainAction() public method

public mainAction ( )
Exemplo n.º 1
0
 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');
 }
Exemplo n.º 2
0
 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');
 }
Exemplo n.º 3
0
 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");
     });
 }