ソースを参照

Fix usage of config() in database, orm, view tests.

Mark Story 8 年 前
コミット
14cb9dcdc0

+ 1 - 1
tests/TestCase/Database/Driver/MysqlTest.php

@@ -32,7 +32,7 @@ class MysqlTest extends TestCase
     public function setup()
     {
         parent::setUp();
-        $config = ConnectionManager::config('test');
+        $config = ConnectionManager::getConfig('test');
         $this->skipIf(strpos($config['driver'], 'Mysql') === false, 'Not using Mysql for test config');
     }
 

+ 1 - 1
tests/TestCase/Database/Schema/MysqlSchemaTest.php

@@ -35,7 +35,7 @@ class MysqlSchemaTest extends TestCase
      */
     protected function _needsConnection()
     {
-        $config = ConnectionManager::config('test');
+        $config = ConnectionManager::getConfig('test');
         $this->skipIf(strpos($config['driver'], 'Mysql') === false, 'Not using Mysql for test config');
     }
 

+ 1 - 1
tests/TestCase/Database/Schema/PostgresSchemaTest.php

@@ -35,7 +35,7 @@ class PostgresSchemaTest extends TestCase
      */
     protected function _needsConnection()
     {
-        $config = ConnectionManager::config('test');
+        $config = ConnectionManager::getConfig('test');
         $this->skipIf(strpos($config['driver'], 'Postgres') === false, 'Not using Postgres for test config');
     }
 

+ 1 - 1
tests/TestCase/Database/Schema/SqliteSchemaTest.php

@@ -35,7 +35,7 @@ class SqliteSchemaTest extends TestCase
      */
     protected function _needsConnection()
     {
-        $config = ConnectionManager::config('test');
+        $config = ConnectionManager::getConfig('test');
         $this->skipIf(strpos($config['driver'], 'Sqlite') === false, 'Not using Sqlite for test config');
     }
 

+ 1 - 1
tests/TestCase/Database/Schema/SqlserverSchemaTest.php

@@ -34,7 +34,7 @@ class SqlserverSchemaTest extends TestCase
      */
     protected function _needsConnection()
     {
-        $config = ConnectionManager::config('test');
+        $config = ConnectionManager::getConfig('test');
         $this->skipIf(strpos($config['driver'], 'Sqlserver') === false, 'Not using Sqlserver for test config');
     }
 

+ 1 - 1
tests/TestCase/ORM/Association/BelongsToManyTest.php

@@ -189,7 +189,7 @@ class BelongsToManyTest extends TestCase
                 ->setMethods(['setDriver'])
                 ->setConstructorArgs(['name' => 'other_source'])
                 ->getMock();
-        ConnectionManager::config('other_source', $mock);
+        ConnectionManager::setConfig('other_source', $mock);
         $this->article->connection(ConnectionManager::get('other_source'));
 
         $assoc = new BelongsToMany('Test', [

+ 4 - 4
tests/TestCase/ORM/Behavior/TreeBehaviorTest.php

@@ -667,7 +667,7 @@ class TreeBehaviorTest extends TestCase
             ->order('lft')
             ->toArray();
         $table->updateAll(['lft' => null, 'rght' => null, 'depth' => null], []);
-        $table->behaviors()->Tree->config('level', 'depth');
+        $table->behaviors()->Tree->setConfig('level', 'depth');
         $table->recover();
 
         $expected = [
@@ -1223,7 +1223,7 @@ class TreeBehaviorTest extends TestCase
         ];
         $this->assertMpttValues($expected, $table);
 
-        $table->behaviors()->get('Tree')->config('scope', ['menu' => 'categories']);
+        $table->behaviors()->get('Tree')->setConfig('scope', ['menu' => 'categories']);
         $expected = [
             ' 1:10 -  9:electronics',
             '_ 2: 9 - 10:televisions',
@@ -1418,7 +1418,7 @@ class TreeBehaviorTest extends TestCase
      */
     public function testSetLevelNewNode()
     {
-        $this->table->behaviors()->Tree->config('level', 'depth');
+        $this->table->behaviors()->Tree->setConfig('level', 'depth');
 
         $entity = new Entity(['parent_id' => null, 'name' => 'Depth 0']);
         $this->table->save($entity);
@@ -1443,7 +1443,7 @@ class TreeBehaviorTest extends TestCase
      */
     public function testSetLevelExistingNode()
     {
-        $this->table->behaviors()->Tree->config('level', 'depth');
+        $this->table->behaviors()->Tree->setConfig('level', 'depth');
 
         // Leaf node
         $entity = $this->table->get(4);

+ 1 - 1
tests/TestCase/ORM/BehaviorRegistryTest.php

@@ -62,7 +62,7 @@ class BehaviorRegistryTest extends TestCase
         $config = ['alias' => 'Sluggable', 'replacement' => '-'];
         $result = $this->Behaviors->load('Sluggable', $config);
         $this->assertInstanceOf('TestApp\Model\Behavior\SluggableBehavior', $result);
-        $this->assertEquals($config, $result->config());
+        $this->assertEquals($config, $result->getConfig());
 
         $result = $this->Behaviors->load('TestPlugin.PersisterOne');
         $this->assertInstanceOf('TestPlugin\Model\Behavior\PersisterOneBehavior', $result);

+ 1 - 1
tests/TestCase/ORM/BehaviorTest.php

@@ -193,7 +193,7 @@ class BehaviorTest extends TestCase
         $table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
         $config = ['key' => 'value'];
         $behavior = new TestBehavior($table, $config);
-        $this->assertEquals($config, $behavior->config());
+        $this->assertEquals($config, $behavior->getConfig());
     }
 
     /**

+ 3 - 3
tests/TestCase/ORM/TableTest.php

@@ -2586,7 +2586,7 @@ class TableTest extends TestCase
      */
     public function testAtomicSave()
     {
-        $config = ConnectionManager::config('test');
+        $config = ConnectionManager::getConfig('test');
 
         $connection = $this->getMockBuilder('\Cake\Database\Connection')
             ->setMethods(['begin', 'commit', 'inTransaction'])
@@ -2623,7 +2623,7 @@ class TableTest extends TestCase
     {
         $connection = $this->getMockBuilder('\Cake\Database\Connection')
             ->setMethods(['begin', 'rollback'])
-            ->setConstructorArgs([ConnectionManager::config('test')])
+            ->setConstructorArgs([ConnectionManager::getConfig('test')])
             ->getMock();
         $connection->setDriver(ConnectionManager::get('test')->getDriver());
         $table = $this->getMockBuilder('\Cake\ORM\Table')
@@ -2663,7 +2663,7 @@ class TableTest extends TestCase
     {
         $connection = $this->getMockBuilder('\Cake\Database\Connection')
             ->setMethods(['begin', 'rollback'])
-            ->setConstructorArgs([ConnectionManager::config('test')])
+            ->setConstructorArgs([ConnectionManager::getConfig('test')])
             ->getMock();
         $connection->setDriver(ConnectionManager::get('test')->getDriver());
         $table = $this->getMockBuilder('\Cake\ORM\Table')

+ 6 - 6
tests/TestCase/View/CellTest.php

@@ -403,7 +403,7 @@ class CellTest extends TestCase
         $mock->expects($this->once())
             ->method('write')
             ->with('cell_test_app_view_cell_articles_cell_display_default', "dummy\n");
-        Cache::config('default', $mock);
+        Cache::setConfig('default', $mock);
 
         $cell = $this->View->cell('Articles', [], ['cache' => true]);
         $result = $cell->render();
@@ -425,7 +425,7 @@ class CellTest extends TestCase
             ->will($this->returnValue("dummy\n"));
         $mock->expects($this->never())
             ->method('write');
-        Cache::config('default', $mock);
+        Cache::setConfig('default', $mock);
 
         $cell = $this->View->cell('Articles', [], ['cache' => true]);
         $result = $cell->render();
@@ -448,7 +448,7 @@ class CellTest extends TestCase
         $mock->expects($this->once())
             ->method('write')
             ->with('my_key', "dummy\n");
-        Cache::config('cell', $mock);
+        Cache::setConfig('cell', $mock);
 
         $cell = $this->View->cell('Articles', [], [
             'cache' => ['key' => 'my_key', 'config' => 'cell']
@@ -473,7 +473,7 @@ class CellTest extends TestCase
         $mock->expects($this->once())
             ->method('write')
             ->with('cell_test_app_view_cell_articles_cell_customTemplate_default', "<h1>This is the alternate template</h1>\n");
-        Cache::config('default', $mock);
+        Cache::setConfig('default', $mock);
 
         $cell = $this->View->cell('Articles::customTemplate', [], ['cache' => true]);
         $result = $cell->render();
@@ -490,7 +490,7 @@ class CellTest extends TestCase
      */
     public function testCachedRenderSimpleCustomTemplateViewBuilder()
     {
-        Cache::config('default', [
+        Cache::setConfig('default', [
             'className' => 'File',
             'path' => CACHE,
         ]);
@@ -512,7 +512,7 @@ class CellTest extends TestCase
      */
     public function testACachedViewCellReRendersWhenGivenADifferentTemplate()
     {
-        Cache::config('default', [
+        Cache::setConfig('default', [
             'className' => 'File',
             'path' => CACHE,
         ]);

+ 5 - 5
tests/TestCase/View/Helper/TimeHelperTest.php

@@ -178,7 +178,7 @@ class TimeHelperTest extends TestCase
      */
     public function testNiceOutputTimezone()
     {
-        $this->Time->config('outputTimezone', 'America/Vancouver');
+        $this->Time->setConfig('outputTimezone', 'America/Vancouver');
         $time = '2014-04-20 20:00';
         $this->assertTimeFormat('Apr 20, 2014, 1:00 PM', $this->Time->nice($time));
     }
@@ -211,7 +211,7 @@ class TimeHelperTest extends TestCase
      */
     public function testToAtomOutputTimezone()
     {
-        $this->Time->config('outputTimezone', 'America/Vancouver');
+        $this->Time->setConfig('outputTimezone', 'America/Vancouver');
         $dateTime = new Time;
         $vancouver = clone $dateTime;
         $vancouver->timezone('America/Vancouver');
@@ -245,7 +245,7 @@ class TimeHelperTest extends TestCase
      */
     public function testToRssOutputTimezone()
     {
-        $this->Time->config('outputTimezone', 'America/Vancouver');
+        $this->Time->setConfig('outputTimezone', 'America/Vancouver');
         $dateTime = new Time;
         $vancouver = clone $dateTime;
         $vancouver->timezone('America/Vancouver');
@@ -548,7 +548,7 @@ class TimeHelperTest extends TestCase
      */
     public function testFormatOutputTimezone()
     {
-        $this->Time->config('outputTimezone', 'America/Vancouver');
+        $this->Time->setConfig('outputTimezone', 'America/Vancouver');
 
         $time = strtotime('Thu Jan 14 8:59:28 2010 UTC');
         $result = $this->Time->format($time);
@@ -568,7 +568,7 @@ class TimeHelperTest extends TestCase
      */
     public function testI18nFormatOutputTimezone()
     {
-        $this->Time->config('outputTimezone', 'America/Vancouver');
+        $this->Time->setConfig('outputTimezone', 'America/Vancouver');
 
         $time = strtotime('Thu Jan 14 8:59:28 2010 UTC');
         $result = $this->Time->i18nFormat($time, \IntlDateFormatter::SHORT);

+ 1 - 1
tests/TestCase/View/HelperTest.php

@@ -98,7 +98,7 @@ class HelperTest extends TestCase
             'key2' => ['key2.1' => 'val2.1', 'key2.2' => 'newval'],
             'key3' => 'val3'
         ];
-        $this->assertEquals($expected, $Helper->config());
+        $this->assertEquals($expected, $Helper->getConfig());
     }
 
     /**

+ 1 - 1
tests/TestCase/View/StringTemplateTraitTest.php

@@ -85,7 +85,7 @@ class StringTemplateTraitTest extends TestCase
      */
     public function testInitStringTemplatesArrayForm()
     {
-        $this->Template->config(
+        $this->Template->setConfig(
             'templates.text',
             '<p>{{text}}</p>'
         );

+ 5 - 5
tests/TestCase/View/ViewTest.php

@@ -989,7 +989,7 @@ class ViewTest extends TestCase
     public function testElementCache()
     {
         Cache::drop('test_view');
-        Cache::config('test_view', [
+        Cache::setConfig('test_view', [
             'engine' => 'File',
             'duration' => '+1 day',
             'path' => CACHE . 'views/',
@@ -1074,7 +1074,7 @@ class ViewTest extends TestCase
         $View->loadHelper('Html', ['foo' => 'bar']);
         $this->assertInstanceOf('Cake\View\Helper\HtmlHelper', $View->Html);
 
-        $config = $View->Html->config();
+        $config = $View->Html->getConfig();
         $this->assertEquals('bar', $config['foo']);
     }
 
@@ -1112,10 +1112,10 @@ class ViewTest extends TestCase
         $this->assertInstanceOf('Cake\View\Helper\HtmlHelper', $View->Html, 'Object type is wrong.');
         $this->assertInstanceOf('Cake\View\Helper\FormHelper', $View->Form, 'Object type is wrong.');
 
-        $config = $View->Html->config();
+        $config = $View->Html->getConfig();
         $this->assertEquals('bar', $config['foo']);
 
-        $config = $View->Form->config();
+        $config = $View->Form->getConfig();
         $this->assertEquals('baz', $config['foo']);
     }
 
@@ -1141,7 +1141,7 @@ class ViewTest extends TestCase
     public function testInitialize()
     {
         $View = new TestView();
-        $config = $View->Html->config();
+        $config = $View->Html->getConfig();
         $this->assertEquals('myval', $config['mykey']);
     }