Merge branch '2.0' into 2.1

This commit is contained in:
ADmad 2011-11-06 20:39:08 +05:30
commit e1354b2ee6
41 changed files with 135 additions and 150 deletions

View file

@ -327,7 +327,7 @@ class ViewTask extends BakeTask {
$this->hr();
$this->out(__d('cake_console', 'Controller Name: %s', $this->controllerName));
$this->out(__d('cake_console', 'Action Name: %s', $action));
$this->out(__d('cake_console', 'Path: %s', $this->params['app'] . DS . 'View' . DS . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
$this->out(__d('cake_console', 'Path: %s', $this->getPath() . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
$this->hr();
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y','n'), 'y');
if (strtolower($looksGood) == 'y') {

View file

@ -102,7 +102,7 @@ class UpgradeShell extends Shell {
public function tests() {
$this->_paths = array(APP . 'tests' . DS);
if (!empty($this->params['plugin'])) {
$this->_paths = App::pluginPath($this->params['plugin']) . 'tests' . DS;
$this->_paths = array(App::pluginPath($this->params['plugin']) . 'tests' . DS);
}
$patterns = array(
array(
@ -225,6 +225,7 @@ class UpgradeShell extends Shell {
}
$helpers = array_merge($pluginHelpers, $helpers);
foreach ($helpers as $helper) {
$helper = preg_replace('/Helper$/', '', $helper);
$oldHelper = strtolower(substr($helper, 0, 1)).substr($helper, 1);
$patterns[] = array(
"\${$oldHelper} to \$this->{$helper}",

View file

@ -447,6 +447,9 @@ class App {
if (empty($path)) {
$path = self::path($type, $plugin);
if (empty($plugin)) {
$path = array_merge($path, App::core($type));
}
}
foreach ((array)$path as $dir) {

View file

@ -39,9 +39,9 @@ if (function_exists('mb_internal_encoding')) {
class I18n {
/**
* Instance of the I10n class for localization
* Instance of the L10n class for localization
*
* @var I10n
* @var L10n
*/
public $l10n = null;
@ -91,6 +91,15 @@ class I18n {
'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME', 'LC_MESSAGES'
);
/**
* Constructor, use I18n::getInstance() to get the i18n translation object.
*
* @return void
*/
protected function __construct() {
$this->l10n = new L10n();
}
/**
* Return a static instance of the I18n class
*
@ -100,7 +109,6 @@ class I18n {
static $instance = array();
if (!$instance) {
$instance[0] = new I18n();
$instance[0]->l10n = new L10n();
}
return $instance[0];
}

View file

@ -2244,26 +2244,28 @@ class Model extends Object {
$savedAssociatons = $this->__backAssociation;
$this->__backAssociation = array();
}
foreach (array_merge($this->hasMany, $this->hasOne) as $assoc => $data) {
if ($data['dependent'] === true && $cascade === true) {
if ($cascade === true) {
foreach (array_merge($this->hasMany, $this->hasOne) as $assoc => $data) {
if ($data['dependent'] === true) {
$model = $this->{$assoc};
$conditions = array($model->escapeField($data['foreignKey']) => $id);
if ($data['conditions']) {
$conditions = array_merge((array)$data['conditions'], $conditions);
}
$model->recursive = -1;
$model = $this->{$assoc};
$conditions = array($model->escapeField($data['foreignKey']) => $id);
if ($data['conditions']) {
$conditions = array_merge((array)$data['conditions'], $conditions);
}
$model->recursive = -1;
if (isset($data['exclusive']) && $data['exclusive']) {
$model->deleteAll($conditions);
} else {
$records = $model->find('all', array(
'conditions' => $conditions, 'fields' => $model->primaryKey
));
if (isset($data['exclusive']) && $data['exclusive']) {
$model->deleteAll($conditions);
} else {
$records = $model->find('all', array(
'conditions' => $conditions, 'fields' => $model->primaryKey
));
if (!empty($records)) {
foreach ($records as $record) {
$model->delete($record[$model->alias][$model->primaryKey]);
if (!empty($records)) {
foreach ($records as $record) {
$model->delete($record[$model->alias][$model->primaryKey]);
}
}
}
}

View file

@ -129,11 +129,11 @@ class CacheTest extends CakeTestCase {
/**
* test that trying to configure classes that don't extend CacheEngine fail.
*
* @expectedException CacheException
* @return void
*/
public function testAttemptingToConfigureANonCacheEngineClass() {
$this->getMock('StdClass', array(), array(), 'RubbishEngine');
$this->expectException();
Cache::config('Garbage', array(
'engine' => 'Rubbish'
));

View file

@ -431,7 +431,6 @@ class ViewTaskTest extends CakeTestCase {
*/
public function testCustomAction() {
$this->Task->controllerName = 'ViewTaskComments';
$this->Task->params['app'] = APP;
$this->Task->expects($this->any())->method('in')
->will($this->onConsecutiveCalls('', 'my_action', 'y'));

View file

@ -56,7 +56,7 @@ class CrudAuthorizeTest extends CakeTestCase {
/**
* test authorize() without a mapped action, ensure an error is generated.
*
* @expectedException Exception
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testAuthorizeNoMappedAction() {

View file

@ -249,6 +249,7 @@ class DbAclTest extends CakeTestCase {
/**
* testDbAclAllow method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testAllow() {
@ -279,17 +280,16 @@ class DbAclTest extends CakeTestCase {
// Samir should still have his tpsReports/view permissions, but does not
$this->assertTrue($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/view', 'update'));
$this->expectError();
$this->assertFalse($this->Acl->allow('Lumbergh', 'ROOT/tpsReports/DoesNotExist', 'create'));
}
/**
* testAllowInvalidNode method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testAllowInvalidNode() {
$this->expectError();
$this->Acl->allow('Homer', 'tpsReports', 'create');
}
@ -316,31 +316,31 @@ class DbAclTest extends CakeTestCase {
/**
* testCheckInvalidNode method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testCheckInvalidNode() {
$this->expectError();
$this->assertFalse($this->Acl->check('WRONG', 'tpsReports', 'read'));
}
/**
* testCheckInvalidPermission method
*
* @expectedException PHPUnit_Framework_Error_Notice
* @return void
*/
public function testCheckInvalidPermission() {
$this->expectError();
$this->assertFalse($this->Acl->check('Lumbergh', 'smash', 'foobar'));
$this->Acl->check('Lumbergh', 'smash', 'foobar');
}
/**
* testCheckMissingPermission method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testCheckMissingPermission() {
$this->expectError();
$this->assertFalse($this->Acl->check('users', 'NonExistant', 'read'));
$this->Acl->check('users', 'NonExistant', 'read');
}
/**
@ -363,6 +363,7 @@ class DbAclTest extends CakeTestCase {
/**
* testDbAclDeny method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testDeny() {
@ -385,7 +386,6 @@ class DbAclTest extends CakeTestCase {
$expected = '-1';
$this->assertEqual($result[0]['PermissionTwoTest']['_delete'], $expected);
$this->expectError();
$this->assertFalse($this->Acl->deny('Lumbergh', 'ROOT/tpsReports/DoesNotExist', 'create'));
}
@ -433,6 +433,7 @@ class DbAclTest extends CakeTestCase {
/**
* testDbGrant method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testGrant() {
@ -447,13 +448,13 @@ class DbAclTest extends CakeTestCase {
$this->assertTrue($this->Acl->check('Micheal', 'view', 'update'));
$this->assertFalse($this->Acl->check('Micheal', 'view', 'delete'));
$this->expectError();
$this->assertFalse($this->Acl->allow('Peter', 'ROOT/tpsReports/DoesNotExist', 'create'));
}
/**
* testDbRevoke method
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testRevoke() {
@ -467,8 +468,7 @@ class DbAclTest extends CakeTestCase {
$this->assertFalse($this->Acl->check('Samir', 'printers', 'read'));
$this->assertFalse($this->Acl->check('Peter', 'printers', 'read'));
$this->expectError();
$this->assertFalse($this->Acl->deny('Bobs', 'ROOT/printers/DoesNotExist', 'create'));
$this->Acl->deny('Bobs', 'ROOT/printers/DoesNotExist', 'create');
}
/**
* debug function - to help editing/creating test cases for the ACL component

View file

@ -629,7 +629,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
*/
public function testAccepts() {
$_SERVER['HTTP_ACCEPT'] = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
$this->assertEqual($this->RequestHandler->accepts(array('js', 'xml', 'html')), 'xml');
$this->assertTrue($this->RequestHandler->accepts(array('js', 'xml', 'html')));
$this->assertFalse($this->RequestHandler->accepts(array('gif', 'jpeg', 'foo')));
$_SERVER['HTTP_ACCEPT'] = '*/*;q=0.5';

View file

@ -303,14 +303,6 @@ class AppTest extends CakeTestCase {
$this->assertTrue(in_array('Dispatcher', $result));
$this->assertTrue(in_array('Router', $result));
App::build(array(
'Model/Behavior' => App::core('Model/Behavior'),
'Controller' => App::core('Controller'),
'Controller/Component' => App::core('Controller/Component'),
'View' => App::core('View'),
'Model' => App::core('Model'),
'View/Helper' => App::core('View/Helper'),
), App::RESET);
$result = App::objects('behavior', null, false);
$this->assertTrue(in_array('TreeBehavior', $result));
$result = App::objects('Model/Behavior', null, false);

View file

@ -342,7 +342,7 @@ class ConfigureTest extends CakeTestCase {
/**
* test reader() throwing exceptions on missing interface.
*
* @expectedException Exception
* @expectedException PHPUnit_Framework_Error
* @return void
*/
public function testReaderExceptionOnIncorrectClass() {

View file

@ -241,6 +241,7 @@ class AclNodeTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
Configure::write('Acl.classname', 'TestDbAcl');
Configure::write('Acl.database', 'test');
}

View file

@ -21,8 +21,6 @@ App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
require_once dirname(__FILE__) . DS . 'models.php';
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* ModelBaseTest
*

View file

@ -19,8 +19,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* Test class
*

View file

@ -20,6 +20,24 @@ App::uses('CakeResponse', 'Network');
class CakeResponseTest extends CakeTestCase {
/**
* Setup for tests
*
* @return void
*/
public function setUp() {
ob_start();
}
/**
* Cleanup after tests
*
* @return void
*/
public function tearDown() {
ob_end_clean();
}
/**
* Tests the request object constructor
*

View file

@ -127,7 +127,7 @@ class SmtpTransportTest extends CakeTestCase {
/**
* testConnectFail method
*
* @expectedException Exception
* @expectedException SocketException
* @return void
*/
public function testConnectFail() {
@ -258,4 +258,4 @@ class SmtpTransportTest extends CakeTestCase {
$this->SmtpTransport->disconnect();
}
}
}

View file

@ -1298,12 +1298,6 @@ class DispatcherTest extends CakeTestCase {
$expected = filesize(CakePlugin::path('TestPlugin') . 'webroot' . DS . 'css' . DS . 'unknown.extension');
$headers = $response->header();
$this->assertEqual($expected, $headers['Content-Length']);
if (php_sapi_name() == 'cli') {
while (ob_get_level()) {
ob_get_clean();
}
}
}
/**

View file

@ -2225,10 +2225,10 @@ class RouterTest extends CakeTestCase {
/**
* test that route classes must extend CakeRoute
*
* @expectedException RouterException
* @return void
*/
public function testCustomRouteException() {
$this->expectException();
Router::connect('/:controller', array(), array('routeClass' => 'Object'));
}

View file

@ -471,6 +471,7 @@ class ControllerTestCaseTest extends CakeTestCase {
* @return void
*/
public function testNoControllerReuse() {
$this->Case->autoMock = true;
$result = $this->Case->testAction('/tests_apps/index', array(
'data' => array('var' => 'first call'),
'method' => 'get',
@ -496,4 +497,17 @@ class ControllerTestCaseTest extends CakeTestCase {
$this->assertContains('third call', $result);
}
/**
* Test that multiple calls to redirect in the same test method don't cause issues.
*
* @return void
*/
public function testTestActionWithMultipleRedirect() {
$Controller = $this->Case->generate('TestsApps');
$options = array('method' => 'get');
$this->Case->testAction('/tests_apps/redirect_to', $options);
$this->Case->testAction('/tests_apps/redirect_to', $options);
}
}

View file

@ -189,30 +189,6 @@ class ObjectCollectionTest extends CakeTestCase {
$this->assertTrue($this->Objects->trigger('callback'));
}
/**
* test that the initalize callback is triggered on all components even those that are disabled.
*
* @return void
*/
public function testTriggerWithTriggerDisabledObjects() {
$this->_makeMockClasses();
$this->Objects->load('TriggerMockFirst', array(), false);
$this->Objects->load('TriggerMockSecond');
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
$this->Objects->TriggerMockFirst->expects($this->once())
->method('callback')
->will($this->returnValue(true));
$this->Objects->TriggerMockSecond->expects($this->once())
->method('callback')
->will($this->returnValue(true));
$result = $this->Objects->trigger('callback', array(), array('triggerDisabled' => true));
$this->assertTrue($result);
}
/**
* test trigger and disabled objects
*

View file

@ -167,7 +167,6 @@ class XmlTest extends CakeTestCase {
array(null),
array(false),
array(''),
array('<tag>')
);
}
@ -175,13 +174,27 @@ class XmlTest extends CakeTestCase {
* testBuildInvalidData
*
* @dataProvider invalidDataProvider
* @expectedException Exception
* @expectedException XmlException
* return void
*/
public function testBuildInvalidData($value) {
Xml::build($value);
}
/**
* test build with a single empty tag
*
* return void
*/
public function testBuildEmptyTag() {
try {
Xml::build('<tag>');
$this->fail('No exception');
} catch (Exception $e) {
$this->assertTrue(true, 'An exception was raised');
}
}
/**
* testFromArray method
*
@ -356,10 +369,14 @@ class XmlTest extends CakeTestCase {
* testFromArrayFail method
*
* @dataProvider invalidArrayDataProvider
* @expectedException Exception
*/
public function testFromArrayFail($value) {
Xml::fromArray($value);
try {
Xml::fromArray($value);
$this->fail('No exception.');
} catch (Exception $e) {
$this->assertTrue(true, 'Caught exception.');
}
}
/**
@ -821,7 +838,7 @@ class XmlTest extends CakeTestCase {
* testToArrayFail method
*
* @dataProvider invalidToArrayDataProvider
* @expectedException Exception
* @expectedException XmlException
*/
public function testToArrayFail($value) {
Xml::toArray($value);

View file

@ -169,6 +169,7 @@ class JsHelperTest extends CakeTestCase {
/**
* test that methods dispatch internally and to the engine class
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testMethodDispatching() {
@ -182,7 +183,6 @@ class JsHelperTest extends CakeTestCase {
$this->Js->event('click', 'callback');
$this->Js->TestJsEngine = new StdClass();
$this->expectError();
$this->Js->someMethodThatSurelyDoesntExist();
}

View file

@ -2175,6 +2175,7 @@ class PaginatorHelperTest extends CakeTestCase {
/**
* test that mock classes injected into paginatorHelper are called when using link()
*
* @expectedException CakeException
* @return void
*/
public function testMockAjaxProviderClassInjection() {
@ -2196,7 +2197,6 @@ class PaginatorHelperTest extends CakeTestCase {
$Paginator->PaginatorMockJs->expects($this->once())->method('link');
$result = $Paginator->link('Page 2', array('page' => 2), array('update' => '#content'));
$this->expectException();
$Paginator = new PaginatorHelper($this->View, array('ajax' => 'Form'));
}

View file

@ -1,7 +1,4 @@
<?php
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* This class helpes in indirectly testing the functionaliteies of CakeTestCase::assertTags
*
@ -118,4 +115,4 @@ class AssertTagsTestCase extends CakeTestCase {
);
$this->assertTags($input, $pattern);
}
}
}

View file

@ -1,7 +1,4 @@
<?php
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* This class helps in testing the life-cycle of fixtures inside a CakeTestCase
*
@ -59,4 +56,4 @@ class FixturizedTestCase extends CakeTestCase {
public function testThrowException() {
throw new Exception();
}
}
}

View file

@ -16,9 +16,6 @@
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('CakeFixtureManager', 'TestSuite/Fixture');
App::uses('CakeTestFixture', 'TestSuite/Fixture');

View file

@ -17,8 +17,6 @@
*/
require_once 'PHPUnit/TextUI/TestRunner.php';
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* A custom test runner for Cake's use of PHPUnit.
*
@ -67,8 +65,13 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
*/
protected function createTestResult() {
$result = new PHPUnit_Framework_TestResult;
if (isset($this->_params['codeCoverage'])) {
$result->collectCodeCoverageInformation(true);
if (!empty($this->_params['codeCoverage'])) {
if (method_exists($result, 'collectCodeCoverageInformation')) {
$result->collectCodeCoverageInformation(true);
}
if (method_exists($result, 'setCodeCoverage')) {
$result->setCodeCoverage(new PHP_CodeCoverage());
}
}
return $result;
}
@ -92,4 +95,4 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
}
return new CakeFixtureManager();
}
}
}

View file

@ -16,8 +16,6 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('Folder', 'Utility');
class CakeTestSuite extends PHPUnit_Framework_TestSuite {

View file

@ -26,8 +26,6 @@ App::uses('CakeTestCase', 'TestSuite');
App::uses('ControllerTestCase', 'TestSuite');
App::uses('CakeTestModel', 'TestSuite/Fixture');
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* Class to customize loading of test suites from CLI
*
@ -70,8 +68,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
} else {
$suite = $runner->getTest(
$this->arguments['test'],
$this->arguments['testFile'],
$this->arguments['syntaxCheck']
$this->arguments['testFile']
);
}
@ -175,4 +172,4 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
}
return $this->arguments['printer'] = $object;
}
}
}

View file

@ -151,9 +151,6 @@ class CakeTestSuiteDispatcher {
$found = include 'PHPUnit' . DS . 'Autoload.php';
}
}
if ($found) {
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
}
return $found;
}

View file

@ -17,8 +17,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('Dispatcher', 'Routing');
App::uses('CakeTestCase', 'TestSuite');
App::uses('Router', 'Routing');
@ -121,7 +119,7 @@ abstract class ControllerTestCase extends CakeTestCase {
*
* @var boolean
*/
public $autoMock = false;
public $autoMock = true;
/**
* Use custom routes during tests

View file

@ -17,9 +17,6 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
abstract class BaseCoverageReport {
/**

View file

@ -16,9 +16,6 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('BaseCoverageReport', 'TestSuite/Coverage');
class HtmlCoverageReport extends BaseCoverageReport {

View file

@ -18,8 +18,6 @@
*/
App::uses('BaseCoverageReport', 'TestSuite/Coverage');
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
class TextCoverageReport extends BaseCoverageReport {
/**

View file

@ -16,8 +16,6 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('ConnectionManager', 'Model');
App::uses('ClassRegistry', 'Utility');

View file

@ -16,9 +16,6 @@
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
App::uses('CakeSchema', 'Model');
/**

View file

@ -17,8 +17,6 @@
*/
require_once 'PHPUnit/TextUI/ResultPrinter.php';
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* CakeBaseReporter contains common reporting features used in the CakePHP Test suite
*
@ -214,4 +212,4 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
$this->paintPass($test, $time);
}
}
}

View file

@ -17,8 +17,6 @@
*/
App::uses('CakeBaseReporter', 'TestSuite/Reporter');
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* CakeHtmlReporter Reports Results of TestSuites and Test Cases
* in an HTML format / context.
@ -143,8 +141,15 @@ class CakeHtmlReporter extends CakeBaseReporter {
echo $this->_paintLinks();
echo '</div>';
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
$coverage = $result->getCodeCoverage()->getSummary();
echo $this->paintCoverage($coverage);
$coverage = $result->getCodeCoverage();
if (method_exists($coverage, 'getSummary')) {
$report = $coverage->getSummary();
echo $this->paintCoverage($report);
}
if (method_exists($coverage, 'getData')) {
$report = $coverage->getData();
echo '<div class="cake-error">' . __('Coverage generation is not supported with PHPUnit 3.6 at this time.') . '</div>';
}
}
$this->paintDocumentEnd();
}

View file

@ -15,12 +15,9 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CakeBaseReporter', 'TestSuite/Reporter');
App::uses('TextCoverageReport', 'TestSuite/Coverage');
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
/**
* CakeTextReporter contains reporting features used for plain text based output
*

View file

@ -42,7 +42,7 @@ abstract class ObjectCollection {
/**
* Loads a new object onto the collection. Can throw a variety of exceptions
*
* Implementations of this class support a `$options['callbacks']` flag which enables/disables
* Implementations of this class support a `$options['enabled']` flag which enables/disables
* a loaded object.
*
* @param string $name Name of object to load.
@ -68,9 +68,6 @@ abstract class ObjectCollection {
* - `collectReturn` Set to true to collect the return of each object into an array.
* This array of return values will be returned from the trigger() call. Defaults to `false`.
*
* - `triggerDisabled` Will trigger the callback on all objects in the collection even the non-enabled
* objects. Defaults to false.
*
* - `modParams` Allows each object the callback gets called on to modify the parameters to the next object.
* Setting modParams to an integer value will allow you to modify the parameter with that index.
* Any non-null value will modify the parameter index indicated.
@ -93,16 +90,12 @@ abstract class ObjectCollection {
'break' => false,
'breakOn' => false,
'collectReturn' => false,
'triggerDisabled' => false,
'modParams' => false
),
$options
);
$collected = array();
$list = $this->_enabled;
if ($options['triggerDisabled'] === true) {
$list = array_keys($this->_loaded);
}
if ($options['modParams'] !== false && !isset($params[$options['modParams']])) {
throw new CakeException(__d('cake_dev', 'Cannot use modParams with indexes that do not exist.'));
}