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: $parser->description(array(
42: __d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line'),
43: __d('cake_console', "<warning>This shell is for backwards-compatibility only</warning>\nuse the test shell instead"),
44: ));
45:
46: return $parser;
47: }
48:
49: 50: 51: 52: 53:
54: protected function _parseArgs() {
55: if (empty($this->args)) {
56: return;
57: }
58: $params = array(
59: 'core' => false,
60: 'app' => false,
61: 'plugin' => null,
62: 'output' => 'text',
63: );
64:
65: $category = $this->args[0];
66:
67: if ($category === 'core') {
68: $params['core'] = true;
69: } elseif ($category === 'app') {
70: $params['app'] = true;
71: } elseif ($category !== 'core') {
72: $params['plugin'] = $category;
73: }
74:
75: if (isset($this->args[1])) {
76: $params['case'] = $this->args[1];
77: }
78: return $params;
79: }
80:
81: 82: 83: 84: 85:
86: public function main() {
87: $this->out(__d('cake_console', 'CakePHP Test Shell'));
88: $this->hr();
89:
90: $args = $this->_parseArgs();
91:
92: if (empty($args['case'])) {
93: return $this->available();
94: }
95:
96: $this->_run($args, $this->_runnerOptions());
97: }
98:
99: }
100: