Browse Source

Fix more usage of config().

Mark Story 8 years ago
parent
commit
db7943d14e

+ 3 - 3
tests/TestCase/Http/ClientTest.php

@@ -38,17 +38,17 @@ class ClientTest extends TestCase
             'host' => 'example.org',
         ];
         $http = new Client($config);
-        $result = $http->config();
+        $result = $http->getConfig();
         foreach ($config as $key => $val) {
             $this->assertEquals($val, $result[$key]);
         }
 
-        $result = $http->config([
+        $result = $http->setConfig([
             'auth' => ['username' => 'mark', 'password' => 'secret']
         ]);
         $this->assertSame($result, $http);
 
-        $result = $http->config();
+        $result = $http->getConfig();
         $expected = [
             'scheme' => 'http',
             'host' => 'example.org',

+ 11 - 11
tests/TestCase/Mailer/EmailTest.php

@@ -1015,8 +1015,8 @@ class EmailTest extends TestCase
             'to' => 'mark@example.com',
             'from' => 'noreply@example.com',
         ];
-        Email::config('test', $settings);
-        $this->assertEquals($settings, Email::config('test'), 'Should be the same.');
+        Email::setConfig('test', $settings);
+        $this->assertEquals($settings, Email::getConfig('test'), 'Should be the same.');
 
         $email = new Email('test');
         $this->assertContains($settings['to'], $email->getTo());
@@ -1034,8 +1034,8 @@ class EmailTest extends TestCase
             'to' => 'mark@example.com',
             'from' => 'noreply@example.com',
         ];
-        Email::config('test', $settings);
-        Email::config('test', $settings);
+        Email::setConfig('test', $settings);
+        Email::setConfig('test', $settings);
     }
 
     /**
@@ -1064,7 +1064,7 @@ class EmailTest extends TestCase
     {
         $config = ['test' => 'ok', 'test2' => true];
         Configure::write('Email.default', $config);
-        Email::config(Configure::consume('Email'));
+        Email::setConfig(Configure::consume('Email'));
         $Email = new Email();
         $this->assertSame($Email->getProfile(), $config);
         Configure::delete('Email');
@@ -1098,7 +1098,7 @@ class EmailTest extends TestCase
             'theme' => 'TestTheme',
             'helpers' => ['Html', 'Form'],
         ];
-        Email::config('test', $config);
+        Email::setConfig('test', $config);
         $this->Email->setProfile('test');
 
         $result = $this->Email->getTo();
@@ -1509,7 +1509,7 @@ class EmailTest extends TestCase
                 )
             );
 
-        Log::config('email', $log);
+        Log::setConfig('email', $log);
 
         $this->Email->setTransport('debug');
         $this->Email->setTo('me@cakephp.org');
@@ -1543,7 +1543,7 @@ class EmailTest extends TestCase
                 )
             );
 
-        Log::config('email', $log);
+        Log::setConfig('email', $log);
 
         $this->Email->setTransport('debug');
         $this->Email->setTo('me@cakephp.org');
@@ -1588,7 +1588,7 @@ class EmailTest extends TestCase
         $this->Email->setFrom('cake@cakephp.org');
         $this->Email->setTo(['you@cakephp.org' => 'You']);
         $this->Email->setSubject('My title');
-        $this->Email->config(['empty']);
+        $this->Email->setConfig(['empty']);
         $this->Email->setTemplate('default');
         $this->Email->setLayout(null);
         $result = $this->Email->send('message body.');
@@ -2223,7 +2223,7 @@ class EmailTest extends TestCase
             'subject' => 'Test mail subject',
             'transport' => 'debug',
         ];
-        Email::config('test', $configs);
+        Email::setConfig('test', $configs);
 
         $this->Email = new Email('test');
 
@@ -2738,7 +2738,7 @@ HTML;
         $mock = $this->getMockBuilder('\Cake\Mailer\AbstractTransport')->getMock();
         $config = ['from' => 'tester@example.org', 'transport' => 'default'];
 
-        Email::config('default', $config);
+        Email::setConfig('default', $config);
         Email::setConfigTransport('default', $mock);
 
         $em = new Email('default');

+ 1 - 1
tests/TestCase/Mailer/Transport/MailTransportTest.php

@@ -35,7 +35,7 @@ class MailTransportTest extends TestCase
         $this->MailTransport = $this->getMockBuilder('Cake\Mailer\Transport\MailTransport')
             ->setMethods(['_mail'])
             ->getMock();
-        $this->MailTransport->config(['additionalParameters' => '-f']);
+        $this->MailTransport->setConfig(['additionalParameters' => '-f']);
     }
 
     /**

+ 15 - 15
tests/TestCase/Mailer/Transport/SmtpTransportTest.php

@@ -81,7 +81,7 @@ class SmtpTransportTest extends TestCase
 
         $this->SmtpTransport = new SmtpTestTransport();
         $this->SmtpTransport->setSocket($this->socket);
-        $this->SmtpTransport->config(['client' => 'localhost']);
+        $this->SmtpTransport->setConfig(['client' => 'localhost']);
     }
 
     /**
@@ -109,7 +109,7 @@ class SmtpTransportTest extends TestCase
      */
     public function testConnectEhloTls()
     {
-        $this->SmtpTransport->config(['tls' => true]);
+        $this->SmtpTransport->setConfig(['tls' => true]);
         $this->socket->expects($this->any())->method('connect')->will($this->returnValue(true));
         $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("220 Welcome message\r\n"));
         $this->socket->expects($this->at(2))->method('write')->with("EHLO localhost\r\n");
@@ -129,7 +129,7 @@ class SmtpTransportTest extends TestCase
      */
     public function testConnectEhloTlsOnNonTlsServer()
     {
-        $this->SmtpTransport->config(['tls' => true]);
+        $this->SmtpTransport->setConfig(['tls' => true]);
         $this->socket->expects($this->any())->method('connect')->will($this->returnValue(true));
         $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("220 Welcome message\r\n"));
         $this->socket->expects($this->at(2))->method('write')->with("EHLO localhost\r\n");
@@ -159,7 +159,7 @@ class SmtpTransportTest extends TestCase
      */
     public function testConnectEhloNoTlsOnRequiredTlsServer()
     {
-        $this->SmtpTransport->config(['tls' => false, 'username' => 'user', 'password' => 'pass']);
+        $this->SmtpTransport->setConfig(['tls' => false, 'username' => 'user', 'password' => 'pass']);
         $this->socket->expects($this->any())->method('connect')->will($this->returnValue(true));
         $this->socket->expects($this->at(1))->method('read')->will($this->returnValue("220 Welcome message\r\n"));
         $this->socket->expects($this->at(2))->method('write')->with("EHLO localhost\r\n");
@@ -225,7 +225,7 @@ class SmtpTransportTest extends TestCase
         $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("334 Pass\r\n"));
         $this->socket->expects($this->at(4))->method('write')->with("c3Rvcnk=\r\n");
         $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("235 OK\r\n"));
-        $this->SmtpTransport->config(['username' => 'mark', 'password' => 'story']);
+        $this->SmtpTransport->setConfig(['username' => 'mark', 'password' => 'story']);
         $this->SmtpTransport->auth();
     }
 
@@ -241,7 +241,7 @@ class SmtpTransportTest extends TestCase
         $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n");
         $this->socket->expects($this->at(1))->method('read')
             ->will($this->returnValue("500 5.3.3 Unrecognized command\r\n"));
-        $this->SmtpTransport->config(['username' => 'mark', 'password' => 'story']);
+        $this->SmtpTransport->setConfig(['username' => 'mark', 'password' => 'story']);
         $this->SmtpTransport->auth();
     }
 
@@ -257,7 +257,7 @@ class SmtpTransportTest extends TestCase
         $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n");
         $this->socket->expects($this->at(1))->method('read')
             ->will($this->returnValue("502 5.3.3 Command not implemented\r\n"));
-        $this->SmtpTransport->config(['username' => 'mark', 'password' => 'story']);
+        $this->SmtpTransport->setConfig(['username' => 'mark', 'password' => 'story']);
         $this->SmtpTransport->auth();
     }
 
@@ -273,7 +273,7 @@ class SmtpTransportTest extends TestCase
         $this->socket->expects($this->at(0))->method('write')->with("AUTH LOGIN\r\n");
         $this->socket->expects($this->at(1))
             ->method('read')->will($this->returnValue("503 5.5.1 Already authenticated\r\n"));
-        $this->SmtpTransport->config(['username' => 'mark', 'password' => 'story']);
+        $this->SmtpTransport->setConfig(['username' => 'mark', 'password' => 'story']);
         $this->SmtpTransport->auth();
     }
 
@@ -289,7 +289,7 @@ class SmtpTransportTest extends TestCase
         $this->socket->expects($this->at(2))->method('write')->with("bWFyaw==\r\n");
         $this->socket->expects($this->at(3))->method('read')
             ->will($this->returnValue("535 5.7.8 Authentication failed\r\n"));
-        $this->SmtpTransport->config(['username' => 'mark', 'password' => 'story']);
+        $this->SmtpTransport->setConfig(['username' => 'mark', 'password' => 'story']);
 
         $e = null;
         try {
@@ -316,7 +316,7 @@ class SmtpTransportTest extends TestCase
         $this->socket->expects($this->at(3))->method('read')->will($this->returnValue("334 Pass\r\n"));
         $this->socket->expects($this->at(4))->method('write')->with("c3Rvcnk=\r\n");
         $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("535 5.7.8 Authentication failed\r\n"));
-        $this->SmtpTransport->config(['username' => 'mark', 'password' => 'story']);
+        $this->SmtpTransport->setConfig(['username' => 'mark', 'password' => 'story']);
 
         $e = null;
         try {
@@ -444,16 +444,16 @@ class SmtpTransportTest extends TestCase
      */
     public function testEmptyConfigArray()
     {
-        $this->SmtpTransport->config([
+        $this->SmtpTransport->setConfig([
             'client' => 'myhost.com',
             'port' => 666
         ]);
-        $expected = $this->SmtpTransport->config();
+        $expected = $this->SmtpTransport->getConfig();
 
         $this->assertEquals(666, $expected['port']);
 
-        $this->SmtpTransport->config([]);
-        $result = $this->SmtpTransport->config();
+        $this->SmtpTransport->setConfig([]);
+        $result = $this->SmtpTransport->getConfig();
         $this->assertEquals($expected, $result);
     }
 
@@ -629,7 +629,7 @@ class SmtpTransportTest extends TestCase
      */
     public function testKeepAlive()
     {
-        $this->SmtpTransport->config(['keepAlive' => true]);
+        $this->SmtpTransport->setConfig(['keepAlive' => true]);
 
         $email = $this->getMockBuilder('Cake\Mailer\Email')
             ->setMethods(['message'])

+ 1 - 1
tests/TestCase/Network/Session/CacheSessionTest.php

@@ -36,7 +36,7 @@ class CacheSessionTest extends TestCase
     public function setUp()
     {
         parent::setUp();
-        Cache::config(['session_test' => ['engine' => 'File']]);
+        Cache::setConfig(['session_test' => ['engine' => 'File']]);
         $this->storage = new CacheSession(['config' => 'session_test']);
     }
 

+ 12 - 12
tests/TestCase/Network/SocketTest.php

@@ -54,7 +54,7 @@ class SocketTest extends TestCase
     public function testConstruct()
     {
         $this->Socket = new Socket();
-        $config = $this->Socket->config();
+        $config = $this->Socket->getConfig();
         $this->assertSame($config, [
             'persistent' => false,
             'host' => 'localhost',
@@ -66,16 +66,16 @@ class SocketTest extends TestCase
         $this->Socket->reset();
         $this->Socket->__construct(['host' => 'foo-bar']);
         $config['host'] = 'foo-bar';
-        $this->assertSame($this->Socket->config(), $config);
+        $this->assertSame($this->Socket->getConfig(), $config);
 
         $this->Socket = new Socket(['host' => 'www.cakephp.org', 'port' => 23, 'protocol' => 'udp']);
-        $config = $this->Socket->config();
+        $config = $this->Socket->getConfig();
 
         $config['host'] = 'www.cakephp.org';
         $config['port'] = 23;
         $config['protocol'] = 'udp';
 
-        $this->assertSame($this->Socket->config(), $config);
+        $this->assertSame($this->Socket->getConfig(), $config);
     }
 
     /**
@@ -126,7 +126,7 @@ class SocketTest extends TestCase
      */
     public function testInvalidConnection($data)
     {
-        $this->Socket->config($data);
+        $this->Socket->setConfig($data);
         $this->Socket->connect();
     }
 
@@ -252,7 +252,7 @@ class SocketTest extends TestCase
         ];
         $this->assertEquals(
             $expected,
-            $anotherSocket->config(),
+            $anotherSocket->getConfig(),
             'Reset should cause config to return the defaults defined in _defaultConfig'
         );
     }
@@ -326,8 +326,8 @@ class SocketTest extends TestCase
         $socket = new Socket($configSslTls);
         try {
             $socket->connect();
-            $this->assertEquals('smtp.gmail.com', $socket->config('host'));
-            $this->assertEquals('ssl', $socket->config('protocol'));
+            $this->assertEquals('smtp.gmail.com', $socket->getConfig('host'));
+            $this->assertEquals('ssl', $socket->getConfig('protocol'));
         } catch (SocketException $e) {
             $this->markTestSkipped('Cannot test network, skipping.');
         }
@@ -481,9 +481,9 @@ class SocketTest extends TestCase
         $this->assertFalse($result['ssl']['allow_self_signed']);
         $this->assertEquals(5, $result['ssl']['verify_depth']);
         $this->assertEquals('smtp.gmail.com', $result['ssl']['CN_match']);
-        $this->assertArrayNotHasKey('ssl_verify_peer', $socket->config());
-        $this->assertArrayNotHasKey('ssl_allow_self_signed', $socket->config());
-        $this->assertArrayNotHasKey('ssl_verify_host', $socket->config());
-        $this->assertArrayNotHasKey('ssl_verify_depth', $socket->config());
+        $this->assertArrayNotHasKey('ssl_verify_peer', $socket->getConfig());
+        $this->assertArrayNotHasKey('ssl_allow_self_signed', $socket->getConfig());
+        $this->assertArrayNotHasKey('ssl_verify_host', $socket->getConfig());
+        $this->assertArrayNotHasKey('ssl_verify_depth', $socket->getConfig());
     }
 }

+ 2 - 2
tests/TestCase/Routing/DispatcherFactoryTest.php

@@ -82,8 +82,8 @@ class DispatcherFactoryTest extends TestCase
         $config = ['config' => 'value', 'priority' => 999];
         $result = DispatcherFactory::add('Routing', $config);
         $this->assertInstanceOf('Cake\Routing\Filter\RoutingFilter', $result);
-        $this->assertEquals($config['config'], $result->config('config'));
-        $this->assertEquals($config['priority'], $result->config('priority'));
+        $this->assertEquals($config['config'], $result->getConfig('config'));
+        $this->assertEquals($config['priority'], $result->getConfig('priority'));
     }
 
     /**

+ 3 - 3
tests/TestCase/Routing/DispatcherFilterTest.php

@@ -34,7 +34,7 @@ class DispatcherFilterTest extends TestCase
     public function testConstructConfig()
     {
         $filter = new DispatcherFilter(['one' => 'value', 'on' => '/blog']);
-        $this->assertEquals('value', $filter->config('one'));
+        $this->assertEquals('value', $filter->getConfig('one'));
     }
 
     /**
@@ -45,10 +45,10 @@ class DispatcherFilterTest extends TestCase
     public function testConstructPriority()
     {
         $filter = new DispatcherFilter();
-        $this->assertEquals(10, $filter->config('priority'));
+        $this->assertEquals(10, $filter->getConfig('priority'));
 
         $filter = new DispatcherFilter(['priority' => 100]);
-        $this->assertEquals(100, $filter->config('priority'));
+        $this->assertEquals(100, $filter->getConfig('priority'));
     }
 
     /**

+ 1 - 1
tests/TestCase/Shell/CacheShellTest.php

@@ -32,7 +32,7 @@ class CacheShellTest extends ConsoleIntegrationTestCase
     public function setUp()
     {
         parent::setUp();
-        Cache::config('test', ['engine' => 'File', 'path' => CACHE]);
+        Cache::setConfig('test', ['engine' => 'File', 'path' => CACHE]);
     }
 
     /**

+ 6 - 6
tests/TestCase/Shell/Helper/TableHelperTest.php

@@ -211,7 +211,7 @@ class TableHelperTest extends TestCase
             ['short', 'Longish thing', 'short'],
             ['Longer thing', 'short', 'Longest Value'],
         ];
-        $this->helper->config(['headerStyle' => false]);
+        $this->helper->setConfig(['headerStyle' => false]);
         $this->helper->output($data);
         $expected = [
             '+--------------+---------------+---------------+',
@@ -235,7 +235,7 @@ class TableHelperTest extends TestCase
             ['short', 'Longish thing', 'short'],
             ['Longer thing', 'short', 'Longest Value'],
         ];
-        $this->helper->config(['headerStyle' => 'error']);
+        $this->helper->setConfig(['headerStyle' => 'error']);
         $this->helper->output($data);
         $expected = [
             '+--------------+---------------+---------------+',
@@ -259,7 +259,7 @@ class TableHelperTest extends TestCase
             ['short', 'Longish thing', 'short'],
             ['Longer thing', 'short', 'Longest Value'],
         ];
-        $this->helper->config(['headers' => false]);
+        $this->helper->setConfig(['headers' => false]);
         $this->helper->output($data);
         $expected = [
             '+--------------+---------------+---------------+',
@@ -282,7 +282,7 @@ class TableHelperTest extends TestCase
             ['short', 'Longish thing', 'short'],
             ['Longer thing', 'short', 'Longest Value']
         ];
-        $this->helper->config(['rowSeparator' => true]);
+        $this->helper->setConfig(['rowSeparator' => true]);
         $this->helper->output($data);
         $expected = [
             '+--------------+---------------+---------------+',
@@ -308,7 +308,7 @@ class TableHelperTest extends TestCase
             ['short', 'Longish thing', 'short'],
             ['Longer thing', 'short', 'Longest Value'],
         ];
-        $this->helper->config(['rowSeparator' => true]);
+        $this->helper->setConfig(['rowSeparator' => true]);
         $this->helper->output($data);
         $expected = [
             '+--------------+---------------+---------------+',
@@ -353,7 +353,7 @@ class TableHelperTest extends TestCase
      */
     public function testOutputHeaderDisabledNoData()
     {
-        $this->helper->config(['header' => false]);
+        $this->helper->setConfig(['header' => false]);
         $this->helper->output([]);
         $this->assertEquals([], $this->stub->messages());
     }

+ 4 - 4
tests/TestCase/TestSuite/FixtureManagerTest.php

@@ -77,7 +77,7 @@ class FixtureManagerTest extends TestCase
 
         $this->manager->setDebug(true);
         $buffer = new ConsoleOutput();
-        Log::config('testQueryLogger', [
+        Log::setConfig('testQueryLogger', [
             'className' => 'Console',
             'stream' => $buffer
         ]);
@@ -109,7 +109,7 @@ class FixtureManagerTest extends TestCase
 
         $this->manager->setDebug(true);
         $buffer = new ConsoleOutput();
-        Log::config('testQueryLogger', [
+        Log::setConfig('testQueryLogger', [
             'className' => 'Console',
             'stream' => $buffer
         ]);
@@ -314,8 +314,8 @@ class FixtureManagerTest extends TestCase
             ->method('execute')
             ->will($this->returnValue($statement));
 
-        ConnectionManager::config('other', $other);
-        ConnectionManager::config('test_other', $testOther);
+        ConnectionManager::setConfig('other', $other);
+        ConnectionManager::setConfig('test_other', $testOther);
 
         // Connect the alias making test_other an alias of other.
         ConnectionManager::alias('test_other', 'other');

+ 2 - 2
tests/test_app/TestApp/Controller/CookieComponentTestController.php

@@ -38,7 +38,7 @@ class CookieComponentTestController extends Controller
     public function view($key = null)
     {
         if (isset($key)) {
-            $this->Cookie->config('key', $key);
+            $this->Cookie->setConfig('key', $key);
         }
         $this->set('ValueFromRequest', $this->request->cookie('NameOfCookie'));
         $this->set('ValueFromCookieComponent', $this->Cookie->read('NameOfCookie'));
@@ -54,7 +54,7 @@ class CookieComponentTestController extends Controller
     {
         $this->autoRender = false;
         if (isset($key)) {
-            $this->Cookie->config('key', $key);
+            $this->Cookie->setConfig('key', $key);
         }
         $this->Cookie->write('NameOfCookie', 'abc');
     }