Skip to content

Commit

Permalink
Merge branch 'master' into 2.5
Browse files Browse the repository at this point in the history
Conflicts:
	lib/Cake/Test/Case/Utility/FileTest.php
	lib/Cake/VERSION.txt
  • Loading branch information
lorenzo committed Apr 6, 2014
2 parents 9892cd0 + 0d80c92 commit 343d327
Show file tree
Hide file tree
Showing 65 changed files with 348 additions and 37 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/Task/ModelTask.php
Expand Up @@ -593,7 +593,7 @@ public function doActsAs($model) {
public function findBelongsTo(Model $model, $associations) {
$fieldNames = array_keys($model->schema(true));
foreach ($fieldNames as $fieldName) {
$offset = strpos($fieldName, '_id');
$offset = substr($fieldName, -3) === '_id';
if ($fieldName != $model->primaryKey && $fieldName !== 'parent_id' && $offset !== false) {
$tmpModelName = $this->_modelNameFromKey($fieldName);
$associations['belongsTo'][] = array(
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/TestShell.php
Expand Up @@ -172,7 +172,7 @@ public function initialize() {
$this->_dispatcher = new CakeTestSuiteDispatcher();
$success = $this->_dispatcher->loadTestFramework();
if (!$success) {
throw new Exception(__d('cake_dev', 'Please install PHPUnit framework <info>(http://www.phpunit.de)</info>'));
throw new Exception(__d('cake_dev', 'Please install PHPUnit framework v3.7 <info>(http://www.phpunit.de)</info>'));
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/Cake/Controller/Controller.php
Expand Up @@ -1075,7 +1075,6 @@ public function postConditions($data = array(), $op = null, $bool = 'AND', $excl
* @param array $whitelist List of allowed options for paging
* @return array Model query results
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate
* @deprecated Will be removed in 3.0. Use PaginatorComponent instead.
*/
public function paginate($object = null, $scope = array(), $whitelist = array()) {
return $this->Components->load('Paginator', $this->paginate)->paginate($object, $scope, $whitelist);
Expand Down
14 changes: 7 additions & 7 deletions lib/Cake/Network/Email/CakeEmail.php
Expand Up @@ -1645,21 +1645,21 @@ protected function _renderTemplates($content) {
$View->plugin = $layoutPlugin;
}

// Convert null to false, as View needs false to disable
// the layout.
if ($layout === null) {
$layout = false;
}

if ($View->get('content') === null) {
$View->set('content', $content);
}

// Convert null to false, as View needs false to disable
// the layout.
if ($this->_layout === null) {
$this->_layout = false;
}

foreach ($types as $type) {
$View->hasRendered = false;
$View->viewPath = $View->layoutPath = 'Emails' . DS . $type;

$render = $View->render($template, $layout);
$render = $View->render($this->_template, $this->_layout);
$render = str_replace(array("\r\n", "\r"), "\n", $render);
$rendered[$type] = $this->_encodeString($render, $this->charset);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Cake/Test/Case/Cache/CacheTest.php
Expand Up @@ -248,6 +248,8 @@ public function testWritingWithConfig() {

/**
* testGroupConfigs method
*
* @return void
*/
public function testGroupConfigs() {
Cache::config('latest', array(
Expand Down Expand Up @@ -301,7 +303,9 @@ public function testGroupConfigs() {

/**
* testGroupConfigsThrowsException method
*
* @expectedException CacheException
* @return void
*/
public function testGroupConfigsThrowsException() {
Cache::groupConfigs('bogus');
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
Expand Up @@ -453,6 +453,8 @@ public function testGroupsReadWrite() {

/**
* Test that clearing with repeat writes works properly
*
* @return void
*/
public function testClearingWithRepeatWrites() {
Cache::config('repeat', array(
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
Expand Up @@ -534,6 +534,8 @@ public function testGenerateConstructor() {

/**
* Test generateUses()
*
* @return void
*/
public function testGenerateUses() {
$result = $this->Task->generateUses('model', 'Model', 'Post');
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
Expand Up @@ -258,6 +258,7 @@ public function testOptionWithBooleanParam() {
* test parsing options that do not exist.
*
* @expectedException ConsoleException
* @return void
*/
public function testOptionThatDoesNotExist() {
$parser = new ConsoleOptionParser('test', false);
Expand All @@ -270,6 +271,7 @@ public function testOptionThatDoesNotExist() {
* test parsing short options that do not exist.
*
* @expectedException ConsoleException
* @return void
*/
public function testShortOptionThatDoesNotExist() {
$parser = new ConsoleOptionParser('test', false);
Expand Down
4 changes: 4 additions & 0 deletions lib/Cake/Test/Case/Console/ShellTest.php
Expand Up @@ -840,6 +840,8 @@ public function testGetOptionParser() {

/**
* Test file and console and logging
*
* @return void
*/
public function testFileAndConsoleLogging() {
// file logging
Expand Down Expand Up @@ -886,6 +888,8 @@ public function testProtectedUseLogger() {

/**
* Test file and console and logging quiet output
*
* @return void
*/
public function testQuietLog() {
$output = $this->getMock('ConsoleOutput', array(), array(), '', false);
Expand Down
29 changes: 28 additions & 1 deletion lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
Expand Up @@ -29,6 +29,8 @@ class PhpAclTest extends CakeTestCase {

/**
* Setup
*
* @return void
*/
public function setUp() {
parent::setUp();
Expand All @@ -44,6 +46,8 @@ public function setUp() {

/**
* Test role inheritance
*
* @return void
*/
public function testRoleInheritance() {
$roles = $this->Acl->Aro->roles('User/peter');
Expand All @@ -58,7 +62,9 @@ public function testRoleInheritance() {
}

/**
* Tst adding a role
* Test adding a role
*
* @return void
*/
public function testAddRole() {
$this->assertEquals(array(array(PhpAro::DEFAULT_ROLE)), $this->Acl->Aro->roles('foobar'));
Expand All @@ -68,6 +74,8 @@ public function testAddRole() {

/**
* Test resolving ARO
*
* @return void
*/
public function testAroResolve() {
$this->Acl->Aro->map = array(
Expand All @@ -92,6 +100,8 @@ public function testAroResolve() {

/**
* test correct resolution of defined aliases
*
* @return void
*/
public function testAroAliases() {
$this->Acl->Aro->map = array(
Expand Down Expand Up @@ -193,6 +203,8 @@ public function testCheck() {

/**
* lhs of defined rules are case insensitive
*
* @return void
*/
public function testCheckIsCaseInsensitive() {
$this->assertTrue($this->Acl->check('hardy', 'controllers/forms/new'));
Expand All @@ -203,6 +215,8 @@ public function testCheckIsCaseInsensitive() {

/**
* allow should work in-memory
*
* @return void
*/
public function testAllow() {
$this->assertFalse($this->Acl->check('jeff', 'foo/bar'));
Expand All @@ -223,6 +237,8 @@ public function testAllow() {

/**
* deny should work in-memory
*
* @return void
*/
public function testDeny() {
$this->assertTrue($this->Acl->check('stan', 'controllers/baz/manager_foo'));
Expand All @@ -237,6 +253,8 @@ public function testDeny() {

/**
* test that a deny rule wins over an equally specific allow rule
*
* @return void
*/
public function testDenyRuleIsStrongerThanAllowRule() {
$this->assertFalse($this->Acl->check('peter', 'baz/bam'));
Expand All @@ -261,6 +279,8 @@ public function testDenyRuleIsStrongerThanAllowRule() {

/**
* test that an invalid configuration throws exception
*
* @return void
*/
public function testInvalidConfigWithAroMissing() {
$this->setExpectedException(
Expand All @@ -286,6 +306,8 @@ public function testInvalidConfigWithAcosMissing() {

/**
* test resolving of ACOs
*
* @return void
*/
public function testAcoResolve() {
$this->assertEquals(array('foo', 'bar'), $this->Acl->Aco->resolve('foo/bar'));
Expand All @@ -305,6 +327,8 @@ public function testAcoResolve() {

/**
* test that declaring cyclic dependencies should give an error when building the tree
*
* @return void
*/
public function testAroDeclarationContainsCycles() {
$config = array(
Expand All @@ -328,6 +352,8 @@ public function testAroDeclarationContainsCycles() {

/**
* test that with policy allow, only denies count
*
* @return void
*/
public function testPolicy() {
// allow by default
Expand All @@ -344,4 +370,5 @@ public function testPolicy() {
$this->assertFalse($this->Acl->check('Role/sales', 'controllers/bar/delete'));
$this->assertFalse($this->Acl->check('Role/sales', 'controllers/bar', 'delete'));
}

}
Expand Up @@ -46,13 +46,15 @@ public function setUp() {

/**
* @expectedException PHPUnit_Framework_Error
* @return void
*/
public function testControllerTypeError() {
$this->auth->controller(new StdClass());
}

/**
* @expectedException CakeException
* @return void
*/
public function testControllerErrorOnMissingMethod() {
$this->auth->controller(new Controller());
Expand Down Expand Up @@ -85,4 +87,5 @@ public function testAuthorizeSuccess() {

$this->assertTrue($this->auth->authorize($user, $request));
}

}
Expand Up @@ -628,6 +628,8 @@ public function testReadLegacyCookieValue() {

/**
* Test reading empty values.
*
* @return void
*/
public function testReadEmpty() {
$_COOKIE['CakeTestCookie'] = array(
Expand Down
Expand Up @@ -863,6 +863,8 @@ public function testMessageId() {

/**
* Make sure from/to are not double encoded when UTF-8 is present
*
* @return void
*/
public function testEncodingFrom() {
$this->Controller->EmailTest->to = 'Teßt <test@example.com>';
Expand Down
Expand Up @@ -677,6 +677,7 @@ public function testPaginateOrderVirtualFieldJoinedModel() {
* Tests for missing models
*
* @expectedException MissingModelException
* @return void
*/
public function testPaginateMissingModel() {
$Controller = new PaginatorTestController($this->request);
Expand Down
Expand Up @@ -172,6 +172,7 @@ public function tearDown() {
* visibility keyword in the blackhole callback
*
* @expectedException BadRequestException
* @return void
*/
public function testBlackholeWithBrokenCallback() {
$request = new CakeRequest('posts/index', false);
Expand Down Expand Up @@ -830,7 +831,7 @@ public function testValidatePostFailNoDisabled() {
/**
* Test that validatePost fails when unlocked fields are changed.
*
* @return
* @return void
*/
public function testValidatePostFailDisabledFieldTampering() {
$this->Controller->Security->startup($this->Controller);
Expand Down
4 changes: 3 additions & 1 deletion lib/Cake/Test/Case/Controller/ScaffoldTest.php
Expand Up @@ -64,6 +64,7 @@ class ScaffoldMockControllerWithFields extends Controller {
* function beforeScaffold
*
* @param string method
* @return boolean true
*/
public function beforeScaffold($method) {
$this->set('scaffoldFields', array('title'));
Expand All @@ -82,7 +83,8 @@ class TestScaffoldMock extends Scaffold {
/**
* Overload _scaffold
*
* @param unknown_type $params
* @param CakeRequest $request
* @return void
*/
protected function _scaffold(CakeRequest $request) {
$this->_params = $request;
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/Test/Case/Core/AppTest.php
Expand Up @@ -362,6 +362,8 @@ public function testListObjects() {

/**
* Make sure that .svn and friends are excluded from App::objects('plugin')
*
* @return void
*/
public function testListObjectsIgnoreDotDirectories() {
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS;
Expand Down Expand Up @@ -793,6 +795,7 @@ public function testLoadingVendor() {
* Tests that the automatic class loader will also find in "libs" folder for both
* app and plugins if it does not find the class in other configured paths
*
* @return void
*/
public function testLoadClassInLibs() {
App::build(array(
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/Core/ConfigureTest.php
Expand Up @@ -436,6 +436,7 @@ public function testClear() {

/**
* @expectedException ConfigureException
* @return void
*/
public function testDumpNoAdapter() {
Configure::dump(TMP . 'test.php', 'does_not_exist');
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/Error/ExceptionRendererTest.php
Expand Up @@ -270,6 +270,8 @@ public function testErrorMethodCoercion() {

/**
* test that helpers in custom CakeErrorController are not lost
*
* @return void
*/
public function testCakeErrorHelpersNotLost() {
$testApp = CAKE . 'Test' . DS . 'test_app' . DS;
Expand Down

0 comments on commit 343d327

Please sign in to comment.