Skip to content

Commit

Permalink
Merge pull request #8312 from antograssiot/master
Browse files Browse the repository at this point in the history
3.2 cleanup
  • Loading branch information
lorenzo committed Feb 22, 2016
2 parents 15dd2d8 + 435edae commit 6207835
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
8 changes: 4 additions & 4 deletions src/Database/Query.php
Expand Up @@ -1430,11 +1430,11 @@ public function update($table)
public function set($key, $value = null, $types = [])
{
if (empty($this->_parts['set'])) {
$this->_parts['set'] = $this->newExpr()->type(',');
$this->_parts['set'] = $this->newExpr()->tieWith(',');
}

if ($this->_parts['set']->isCallable($key)) {
$exp = $this->newExpr()->type(',');
$exp = $this->newExpr()->tieWith(',');
$this->_parts['set']->add($key($exp));
return $this;
}
Expand Down Expand Up @@ -1811,11 +1811,11 @@ protected function _conjugate($part, $append, $conjunction, $types)
$append = $append($this->newExpr(), $this);
}

if ($expression->type() === $conjunction) {
if ($expression->tieWith() === $conjunction) {
$expression->add($append, $types);
} else {
$expression = $this->newExpr()
->type($conjunction)
->tieWith($conjunction)
->add([$append, $expression], $types);
}

Expand Down
6 changes: 3 additions & 3 deletions src/ORM/Behavior/TreeBehavior.php
Expand Up @@ -880,15 +880,15 @@ protected function _sync($shift, $dir, $conditions, $mark = false)
$exp = $query->newExpr();

$movement = clone $exp;
$movement ->add($field)->add("$shift")->type($dir);
$movement ->add($field)->add("$shift")->tieWith($dir);

$inverse = clone $exp;
$movement = $mark ?
$inverse->add($movement)->type('*')->add('-1'):
$inverse->add($movement)->tieWith('*')->add('-1'):
$movement;

$where = clone $exp;
$where->add($field)->add($conditions)->type('');
$where->add($field)->add($conditions)->tieWith('');

$query->update()
->set($exp->eq($field, $movement))
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Cache/Engine/FileEngineTest.php
Expand Up @@ -250,8 +250,8 @@ public function testClearWithPrefixes()
]);

$dataOne = $dataTwo = $expected = 'content to cache';
$FileOne->write('prefix_one_key_one', $dataOne, DAY);
$FileTwo->write('prefix_two_key_two', $dataTwo, DAY);
$FileOne->write('prefix_one_key_one', $dataOne);
$FileTwo->write('prefix_two_key_two', $dataTwo);

$this->assertEquals($expected, $FileOne->read('prefix_one_key_one'));
$this->assertEquals($expected, $FileTwo->read('prefix_two_key_two'));
Expand All @@ -275,7 +275,7 @@ public function testClearWithGroups()
'groups' => ['short', 'round']
]);
$key = 'cake_test_test_key';
$engine->write($key, 'it works', DAY);
$engine->write($key, 'it works');
$engine->clear(false);
$this->assertFalse($engine->read($key), 'Key should have been removed');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Console/ConsoleOutputTest.php
Expand Up @@ -115,8 +115,8 @@ public function testStylesGet()
$this->assertNull($this->output->styles('made_up_goop'));

$result = $this->output->styles();
$this->assertNotEmpty($result, 'error', 'Error is missing');
$this->assertNotEmpty($result, 'warning', 'Warning is missing');
$this->assertNotEmpty($result, 'Error is missing');
$this->assertNotEmpty($result, 'Warning is missing');
}

/**
Expand Down
Expand Up @@ -1144,7 +1144,7 @@ public function testCheckNotModifiedNoInfo()
$RequestHandler = new RequestHandlerComponent($this->Controller->components());
$RequestHandler->response = $this->getMock('Cake\Network\Response', ['notModified', 'stop']);
$RequestHandler->response->expects($this->never())->method('notModified');
$this->assertNull($RequestHandler->beforeRender($event, '', $RequestHandler->response));
$this->assertNull($RequestHandler->beforeRender($event));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Controller/ControllerTest.php
Expand Up @@ -481,7 +481,7 @@ public function testRedirectByCode($code, $msg)
{
$Controller = new Controller(null, new Response());

$response = $Controller->redirect('http://cakephp.org', (int)$code, false);
$response = $Controller->redirect('http://cakephp.org', (int)$code);
$this->assertEquals($code, $response->statusCode());
$this->assertEquals('http://cakephp.org', $response->header()['Location']);
$this->assertFalse($Controller->autoRender);
Expand Down Expand Up @@ -519,7 +519,7 @@ public function testRedirectBeforeRedirectModifyingStatusCode()
$response->statusCode(302);
}, 'Controller.beforeRedirect');

$response = $Controller->redirect('http://cakephp.org', 301, false);
$response = $Controller->redirect('http://cakephp.org', 301);

$this->assertEquals('http://cakephp.org', $response->header()['Location']);
$this->assertEquals(302, $response->statusCode());
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Database/Log/QueryLoggerTest.php
Expand Up @@ -134,10 +134,10 @@ public function testLogFunction()
$query->params = ['string', '3', null];

$engine = $this->getMock('\Cake\Log\Engine\BaseLog', ['log'], ['scopes' => ['queriesLog']]);
Log::engine('queryLoggerTest', $engine);
Log::engine('queryLoggerTest');

$engine2 = $this->getMock('\Cake\Log\Engine\BaseLog', ['log'], ['scopes' => ['foo']]);
Log::engine('queryLoggerTest2', $engine2);
Log::engine('queryLoggerTest2');

$engine2->expects($this->never())->method('log');
$logger->log($query);
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/DatabaseSuite.php
Expand Up @@ -52,7 +52,7 @@ public function count()
* @param \PHPUnit_Framework_TestResult $result
* @return \PHPUnit_Framework_TestResult
*/
public function run(PHPUnit_Framework_TestResult $result = null, $filter = false, array $groups = [], array $excludeGroups = [], $processIsolation = false)
public function run(PHPUnit_Framework_TestResult $result = null)
{
$permutations = [
'Identifier Quoting' => function () {
Expand All @@ -65,7 +65,7 @@ public function run(PHPUnit_Framework_TestResult $result = null, $filter = false

foreach ($permutations as $permutation) {
$permutation();
$result = parent::run($result, $filter, $groups, $excludeGroups, $processIsolation);
$result = parent::run($result);
}
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Network/Http/ClientTest.php
Expand Up @@ -52,7 +52,7 @@ public function testConstructConfig()
'host' => 'example.org',
'auth' => ['username' => 'mark', 'password' => 'secret']
];
foreach ($config as $key => $val) {
foreach ($expected as $key => $val) {
$this->assertEquals($val, $result[$key]);
}
}
Expand Down
46 changes: 23 additions & 23 deletions tests/TestCase/Validation/ValidationTest.php
Expand Up @@ -604,51 +604,51 @@ public function testCc()
public function testLuhn()
{
//American Express
$this->assertTrue(Validation::luhn('370482756063980', true));
$this->assertTrue(Validation::luhn('370482756063980'));
//BankCard
$this->assertTrue(Validation::luhn('5610745867413420', true));
$this->assertTrue(Validation::luhn('5610745867413420'));
//Diners Club 14
$this->assertTrue(Validation::luhn('30155483651028', true));
$this->assertTrue(Validation::luhn('30155483651028'));
//2004 MasterCard/Diners Club Alliance International 14
$this->assertTrue(Validation::luhn('36747701998969', true));
$this->assertTrue(Validation::luhn('36747701998969'));
//2004 MasterCard/Diners Club Alliance US & Canada 16
$this->assertTrue(Validation::luhn('5597511346169950', true));
$this->assertTrue(Validation::luhn('5597511346169950'));
//Discover
$this->assertTrue(Validation::luhn('6011802876467237', true));
$this->assertTrue(Validation::luhn('6011802876467237'));
//enRoute
$this->assertTrue(Validation::luhn('201496944158937', true));
$this->assertTrue(Validation::luhn('201496944158937'));
//JCB 15 digit
$this->assertTrue(Validation::luhn('210034762247893', true));
$this->assertTrue(Validation::luhn('210034762247893'));
//JCB 16 digit
$this->assertTrue(Validation::luhn('3096806857839939', true));
$this->assertTrue(Validation::luhn('3096806857839939'));
//Maestro (debit card)
$this->assertTrue(Validation::luhn('5020147409985219', true));
$this->assertTrue(Validation::luhn('5020147409985219'));
//Mastercard
$this->assertTrue(Validation::luhn('5580424361774366', true));
$this->assertTrue(Validation::luhn('5580424361774366'));
//Solo 16
$this->assertTrue(Validation::luhn('6767432107064987', true));
$this->assertTrue(Validation::luhn('6767432107064987'));
//Solo 18
$this->assertTrue(Validation::luhn('676714834398858593', true));
$this->assertTrue(Validation::luhn('676714834398858593'));
//Solo 19
$this->assertTrue(Validation::luhn('6767838565218340113', true));
$this->assertTrue(Validation::luhn('6767838565218340113'));
//Switch 16
$this->assertTrue(Validation::luhn('5641829171515733', true));
$this->assertTrue(Validation::luhn('5641829171515733'));
//Switch 18
$this->assertTrue(Validation::luhn('493622764224625174', true));
$this->assertTrue(Validation::luhn('493622764224625174'));
//Switch 19
$this->assertTrue(Validation::luhn('6759603460617628716', true));
$this->assertTrue(Validation::luhn('6759603460617628716'));
//VISA 13 digit
$this->assertTrue(Validation::luhn('4024007174754', true));
$this->assertTrue(Validation::luhn('4024007174754'));
//VISA 16 digit
$this->assertTrue(Validation::luhn('4916375389940009', true));
$this->assertTrue(Validation::luhn('4916375389940009'));
//Visa Electron
$this->assertTrue(Validation::luhn('4175003346287100', true));
$this->assertTrue(Validation::luhn('4175003346287100'));
//Voyager
$this->assertTrue(Validation::luhn('869940697287073', true));
$this->assertTrue(Validation::luhn('869940697287073'));

$this->assertFalse(Validation::luhn('0000000000000000', true));
$this->assertFalse(Validation::luhn('0000000000000000'));

$this->assertFalse(Validation::luhn('869940697287173', true));
$this->assertFalse(Validation::luhn('869940697287173'));
}

/**
Expand Down

0 comments on commit 6207835

Please sign in to comment.