CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.4 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.4
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • CakeBaseReporter
  • CakeHtmlReporter
  • CakeTextReporter
  1: <?php
  2: /**
  3:  * CakeBaseReporter contains common functionality to all cake test suite reporters.
  4:  *
  5:  * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
  6:  * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  7:  *
  8:  * Licensed under The MIT License
  9:  * For full copyright and license information, please see the LICENSE.txt
 10:  * Redistributions of files must retain the above copyright notice
 11:  *
 12:  * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 13:  * @link          http://cakephp.org CakePHP(tm) Project
 14:  * @since         CakePHP(tm) v 1.3
 15:  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 16:  */
 17: 
 18: require_once 'PHPUnit/TextUI/ResultPrinter.php';
 19: 
 20: /**
 21:  * CakeBaseReporter contains common reporting features used in the CakePHP Test suite
 22:  *
 23:  * @package       Cake.TestSuite.Reporter
 24:  */
 25: class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
 26: 
 27: /**
 28:  * Headers sent
 29:  *
 30:  * @var boolean
 31:  */
 32:     protected $_headerSent = false;
 33: 
 34: /**
 35:  * Array of request parameters. Usually parsed GET params.
 36:  *
 37:  * @var array
 38:  */
 39:     public $params = array();
 40: 
 41: /**
 42:  * Character set for the output of test reporting.
 43:  *
 44:  * @var string
 45:  */
 46:     protected $_characterSet;
 47: 
 48: /**
 49:  * Does nothing yet. The first output will
 50:  * be sent on the first test start.
 51:  *
 52:  * ### Params
 53:  *
 54:  * - show_passes - Should passes be shown
 55:  * - plugin - Plugin test being run?
 56:  * - core - Core test being run.
 57:  * - case - The case being run
 58:  * - codeCoverage - Whether the case/group being run is being code covered.
 59:  *
 60:  * @param string $charset The character set to output with. Defaults to UTF-8
 61:  * @param array $params Array of request parameters the reporter should use. See above.
 62:  */
 63:     public function __construct($charset = 'utf-8', $params = array()) {
 64:         if (!$charset) {
 65:             $charset = 'utf-8';
 66:         }
 67:         $this->_characterSet = $charset;
 68:         $this->params = $params;
 69:     }
 70: 
 71: /**
 72:  * Retrieves a list of test cases from the active Manager class,
 73:  * displaying it in the correct format for the reporter subclass
 74:  *
 75:  * @return mixed
 76:  */
 77:     public function testCaseList() {
 78:         $testList = CakeTestLoader::generateTestList($this->params);
 79:         return $testList;
 80:     }
 81: 
 82: /**
 83:  * Paints the start of the response from the test suite.
 84:  * Used to paint things like head elements in an html page.
 85:  *
 86:  * @return void
 87:  */
 88:     public function paintDocumentStart() {
 89:     }
 90: 
 91: /**
 92:  * Paints the end of the response from the test suite.
 93:  * Used to paint things like </body> in an html page.
 94:  *
 95:  * @return void
 96:  */
 97:     public function paintDocumentEnd() {
 98:     }
 99: 
100: /**
101:  * Paint a list of test sets, core, app, and plugin test sets
102:  * available.
103:  *
104:  * @return void
105:  */
106:     public function paintTestMenu() {
107:     }
108: 
109: /**
110:  * Get the baseUrl if one is available.
111:  *
112:  * @return string The base URL for the request.
113:  */
114:     public function baseUrl() {
115:         if (!empty($_SERVER['PHP_SELF'])) {
116:             return $_SERVER['PHP_SELF'];
117:         }
118:         return '';
119:     }
120: 
121: /**
122:  * Print result
123:  *
124:  * @param PHPUnit_Framework_TestResult $result
125:  * @return void
126:  */
127:     public function printResult(PHPUnit_Framework_TestResult $result) {
128:         $this->paintFooter($result);
129:     }
130: 
131: /**
132:  * Paint result
133:  *
134:  * @param PHPUnit_Framework_TestResult $result
135:  * @return void
136:  */
137:     public function paintResult(PHPUnit_Framework_TestResult $result) {
138:         $this->paintFooter($result);
139:     }
140: 
141: /**
142:  * An error occurred.
143:  *
144:  * @param  PHPUnit_Framework_Test $test
145:  * @param  Exception              $e
146:  * @param  float                  $time
147:  * @return void
148:  */
149:     public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) {
150:         $this->paintException($e, $test);
151:     }
152: 
153: /**
154:  * A failure occurred.
155:  *
156:  * @param  PHPUnit_Framework_Test $test
157:  * @param  PHPUnit_Framework_AssertionFailedError $e
158:  * @param  float $time
159:  * @return void
160:  */
161:     public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
162:         $this->paintFail($e, $test);
163:     }
164: 
165: /**
166:  * Incomplete test.
167:  *
168:  * @param  PHPUnit_Framework_Test $test
169:  * @param  Exception $e
170:  * @param  float $time
171:  * @return void
172:  */
173:     public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
174:         $this->paintSkip($e, $test);
175:     }
176: 
177: /**
178:  * Skipped test.
179:  *
180:  * @param  PHPUnit_Framework_Test $test
181:  * @param  Exception $e
182:  * @param  float $time
183:  * @return void
184:  */
185:     public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
186:         $this->paintSkip($e, $test);
187:     }
188: 
189: /**
190:  * A test suite started.
191:  *
192:  * @param  PHPUnit_Framework_TestSuite $suite
193:  * @return void
194:  */
195:     public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
196:         if (!$this->_headerSent) {
197:             echo $this->paintHeader();
198:         }
199:         echo __d('cake_dev', 'Running  %s', $suite->getName()) . "\n";
200:     }
201: 
202: /**
203:  * A test suite ended.
204:  *
205:  * @param  PHPUnit_Framework_TestSuite $suite
206:  * @return void
207:  */
208:     public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
209:     }
210: 
211: /**
212:  * A test started.
213:  *
214:  * @param  PHPUnit_Framework_Test $test
215:  * @return void
216:  */
217:     public function startTest(PHPUnit_Framework_Test $test) {
218:     }
219: 
220: /**
221:  * A test ended.
222:  *
223:  * @param  PHPUnit_Framework_Test $test
224:  * @param  float $time
225:  * @return void
226:  */
227:     public function endTest(PHPUnit_Framework_Test $test, $time) {
228:         $this->numAssertions += $test->getNumAssertions();
229:         if ($test->hasFailed()) {
230:             return;
231:         }
232:         $this->paintPass($test, $time);
233:     }
234: 
235: }
236: 
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs