Skip to content

Commit

Permalink
PHPCS fixes and doc block corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 29, 2015
1 parent 485475c commit 54ffe64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/ORM/Behavior/CounterCacheBehavior.php
Expand Up @@ -139,7 +139,7 @@ protected function _processAssociation(Event $event, EntityInterface $entity, As
$countConditions = $entity->extract($foreignKeys);
$updateConditions = array_combine($primaryKeys, $countConditions);
$countOriginalConditions = $entity->extractOriginalChanged($foreignKeys);

if ($countOriginalConditions !== []) {
$updateOriginalConditions = array_combine($primaryKeys, $countOriginalConditions);
}
Expand Down
5 changes: 2 additions & 3 deletions tests/Fixture/CounterCacheUserCategoryPostsFixture.php
Expand Up @@ -9,16 +9,15 @@
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 1.2.0
* @since 3.1.4
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\Fixture;

use Cake\TestSuite\Fixture\TestFixture;

/**
* Short description for class.
*
* CounterCache test fixture for testing binding keys.
*/
class CounterCacheUserCategoryPostsFixture extends TestFixture
{
Expand Down
14 changes: 7 additions & 7 deletions tests/TestCase/ORM/Behavior/CounterCacheBehaviorTest.php
Expand Up @@ -80,7 +80,7 @@ public function setUp()
'connection' => $this->connection
]);

$this->user_category_posts = new Table([
$this->userCategoryPosts = new Table([
'alias' => 'UserCategoryPosts',
'table' => 'counter_cache_user_category_posts',
'connection' => $this->connection
Expand Down Expand Up @@ -372,7 +372,7 @@ public function testMultiple()
$this->assertEquals(2, $before->get('post_count'));
$this->assertEquals(3, $after->get('post_count'));
}

/**
* Tests to see that the binding key configuration is respected.
*
Expand All @@ -384,20 +384,20 @@ public function testBindingKey()
'bindingKey' => ['category_id', 'user_id'],
'foreignKey' => ['category_id', 'user_id']
]);
$this->post->association('UserCategoryPosts')->target($this->user_category_posts);
$this->post->association('UserCategoryPosts')->target($this->userCategoryPosts);
$this->post->addBehavior('CounterCache', [
'UserCategoryPosts' => ['post_count']
]);
$before = $this->user_category_posts->find()

$before = $this->userCategoryPosts->find()
->where(['user_id' => 1, 'category_id' => 2])
->first();
$entity = $this->_getEntity()->set('category_id', 2);
$this->post->save($entity);
$after = $this->user_category_posts->find()
$after = $this->userCategoryPosts->find()
->where(['user_id' => 1, 'category_id' => 2])
->first();

$this->assertEquals(1, $before->get('post_count'));
$this->assertEquals(2, $after->get('post_count'));
}
Expand Down

0 comments on commit 54ffe64

Please sign in to comment.