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