1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
19:
20: App::uses('TestShell', 'Console/Command');
21: App::uses('AppShell', 'Console/Command');
22: App::uses('CakeTestSuiteDispatcher', 'TestSuite');
23: App::uses('CakeTestSuiteCommand', 'TestSuite');
24: App::uses('CakeTestLoader', 'TestSuite');
25:
26: 27: 28: 29: 30: 31:
32: class TestsuiteShell extends TestShell {
33:
34: 35: 36: 37: 38:
39: public function getOptionParser() {
40: $parser = parent::getOptionParser();
41:
42: $parser->description(array(
43: __d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line'),
44: __d('cake_console', "<warning>This shell is for backwards-compatibility only</warning>\nuse the test shell instead")
45: ));
46:
47: return $parser;
48: }
49:
50: 51: 52: 53: 54:
55: protected function _parseArgs() {
56: if (empty($this->args)) {
57: return;
58: }
59: $params = array(
60: 'core' => false,
61: 'app' => false,
62: 'plugin' => null,
63: 'output' => 'text',
64: );
65:
66: $category = $this->args[0];
67:
68: if ($category === 'core') {
69: $params['core'] = true;
70: } elseif ($category === 'app') {
71: $params['app'] = true;
72: } elseif ($category !== 'core') {
73: $params['plugin'] = $category;
74: }
75:
76: if (isset($this->args[1])) {
77: $params['case'] = $this->args[1];
78: }
79: return $params;
80: }
81:
82: 83: 84: 85: 86:
87: public function main() {
88: $this->out(__d('cake_console', 'CakePHP Test Shell'));
89: $this->hr();
90:
91: $args = $this->_parseArgs();
92:
93: if (empty($args['case'])) {
94: return $this->available();
95: }
96:
97: $this->_run($args, $this->_runnerOptions());
98: }
99:
100: }
101: