/
ApiShellTest.php
66 lines (59 loc) · 1.77 KB
/
ApiShellTest.php
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
62
63
64
65
66
<?php
/**
* CakePHP : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
* @link http://cakephp.org CakePHP Project
* @package Cake.Test.Case.Console.Command
* @since CakePHP v 1.2.0.7726
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Console\Command;
use Cake\Console\Command\ApiShellShell;
use Cake\TestSuite\TestCase;
/**
* ApiShellTest class
*
* @package Cake.Test.Case.Console.Command
*/
class ApiShellTest extends TestCase {
/**
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
$out = $this->getMock('Cake\Console\ConsoleOutput', [], [], '', false);
$in = $this->getMock('Cake\Console\ConsoleInput', [], [], '', false);
$this->Shell = $this->getMock(
'Cake\Console\Command\ApiShell',
['in', 'out', 'createFile', 'hr', '_stop'],
[$out, $out, $in]
);
}
/**
* Test that method names are detected properly including those with no arguments.
*
* @return void
*/
public function testMethodNameDetection() {
$this->Shell->expects($this->any())
->method('in')->will($this->returnValue('q'));
$this->Shell->expects($this->at(0))
->method('out')->with('Controller');
$this->Shell->expects($this->at(2))
->method('out')
->with($this->logicalAnd(
$this->contains('8. beforeFilter($event)'),
$this->contains('24. render($view = NULL, $layout = NULL)')
));
$this->Shell->args = ['controller'];
$this->Shell->paths['controller'] = CAKE . 'Controller/';
$this->Shell->main();
}
}