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