Browse Source

Merge pull request #8312 from antograssiot/master

3.2 cleanup
José Lorenzo Rodríguez 10 years ago
parent
commit
62078357d3

+ 4 - 4
src/Database/Query.php

@@ -1430,11 +1430,11 @@ class Query implements ExpressionInterface, IteratorAggregate
     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;
         }
@@ -1811,11 +1811,11 @@ class Query implements ExpressionInterface, IteratorAggregate
             $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);
         }
 

+ 3 - 3
src/ORM/Behavior/TreeBehavior.php

@@ -880,15 +880,15 @@ class TreeBehavior extends Behavior
             $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))

+ 3 - 3
tests/TestCase/Cache/Engine/FileEngineTest.php

@@ -250,8 +250,8 @@ class FileEngineTest extends TestCase
         ]);
 
         $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'));
@@ -275,7 +275,7 @@ class FileEngineTest extends TestCase
             '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');
     }

+ 2 - 2
tests/TestCase/Console/ConsoleOutputTest.php

@@ -115,8 +115,8 @@ class ConsoleOutputTest extends TestCase
         $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');
     }
 
     /**

+ 1 - 1
tests/TestCase/Controller/Component/RequestHandlerComponentTest.php

@@ -1144,7 +1144,7 @@ class RequestHandlerComponentTest extends TestCase
         $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));
     }
 
     /**

+ 2 - 2
tests/TestCase/Controller/ControllerTest.php

@@ -481,7 +481,7 @@ class ControllerTest extends TestCase
     {
         $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);
@@ -519,7 +519,7 @@ class ControllerTest extends TestCase
             $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());

+ 2 - 2
tests/TestCase/Database/Log/QueryLoggerTest.php

@@ -134,10 +134,10 @@ class QueryLoggerTest extends TestCase
         $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);

+ 2 - 2
tests/TestCase/DatabaseSuite.php

@@ -52,7 +52,7 @@ class DatabaseSuite extends TestSuite
      * @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 () {
@@ -65,7 +65,7 @@ class DatabaseSuite extends TestSuite
 
         foreach ($permutations as $permutation) {
             $permutation();
-            $result = parent::run($result, $filter, $groups, $excludeGroups, $processIsolation);
+            $result = parent::run($result);
         }
         return $result;
     }

+ 1 - 1
tests/TestCase/Network/Http/ClientTest.php

@@ -52,7 +52,7 @@ class ClientTest extends TestCase
             'host' => 'example.org',
             'auth' => ['username' => 'mark', 'password' => 'secret']
         ];
-        foreach ($config as $key => $val) {
+        foreach ($expected as $key => $val) {
             $this->assertEquals($val, $result[$key]);
         }
     }

+ 23 - 23
tests/TestCase/Validation/ValidationTest.php

@@ -604,51 +604,51 @@ class ValidationTest extends TestCase
     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'));
     }
 
     /**