Browse Source

Replace other literal configure calls with new convenience function setAppNamespace()

Marc Würth 8 years ago
parent
commit
41671410cb

+ 1 - 2
tests/TestCase/Core/AppTest.php

@@ -14,7 +14,6 @@
 namespace Cake\Test\TestCase\Core;
 
 use Cake\Core\App;
-use Cake\Core\Configure;
 use Cake\Core\Plugin;
 use Cake\TestSuite\TestCase;
 use TestApp\Core\TestApp;
@@ -93,7 +92,7 @@ class AppTest extends TestCase
      */
     public function testShortNameWithNestedAppNamespace()
     {
-        Configure::write('App.namespace', 'TestApp/Nested');
+        static::setAppNamespace('TestApp/Nested');
 
         $return = TestApp::shortName(
             'TestApp/Nested/Controller/PagesController',

+ 1 - 2
tests/TestCase/Http/MiddlewareQueueTest.php

@@ -46,8 +46,7 @@ class MiddlewareQueueTest extends TestCase
     public function tearDown()
     {
         parent::tearDown();
-
-        Configure::write('App.namespace', $this->appNamespace);
+        static::setAppNamespace($this->appNamespace);
     }
 
     /**

+ 1 - 1
tests/TestCase/Mailer/MailerAwareTraitTest.php

@@ -45,7 +45,7 @@ class MailerAwareTraitTest extends TestCase
         static::setAppNamespace();
         $stub = new Stub();
         $this->assertInstanceOf('TestApp\Mailer\TestMailer', $stub->getMailer('Test'));
-        Configure::write('App.namespace', $originalAppNamespace);
+        static::setAppNamespace($originalAppNamespace);
     }
 
     /**

+ 1 - 2
tests/TestCase/Shell/CompletionShellTest.php

@@ -16,7 +16,6 @@ namespace Cake\Test\TestCase\Shell;
 
 use Cake\Console\ConsoleIo;
 use Cake\Console\ConsoleOutput;
-use Cake\Core\Configure;
 use Cake\Core\Plugin;
 use Cake\TestSuite\TestCase;
 
@@ -74,7 +73,7 @@ class CompletionShellTest extends TestCase
     {
         parent::tearDown();
         unset($this->Shell);
-        Configure::write('App.namespace', 'App');
+        static::setAppNamespace('App');
         Plugin::unload();
     }
 

+ 1 - 1
tests/TestCase/View/Helper/FormHelperTest.php

@@ -144,7 +144,7 @@ class FormHelperTest extends TestCase
 
         Configure::write('Config.language', 'eng');
         Configure::write('App.base', '');
-        Configure::write('App.namespace', 'Cake\Test\TestCase\View\Helper');
+        static::setAppNamespace('Cake\Test\TestCase\View\Helper');
         $this->View = new View();
 
         $this->Form = new FormHelper($this->View);

+ 1 - 1
tests/TestCase/View/Helper/NumberHelperTest.php

@@ -74,7 +74,7 @@ class NumberHelperTest extends TestCase
     public function tearDown()
     {
         parent::tearDown();
-        Configure::write('App.namespace', $this->_appNamespace);
+        static::setAppNamespace($this->_appNamespace);
         unset($this->View);
     }
 

+ 1 - 1
tests/TestCase/View/Helper/TextHelperTest.php

@@ -78,7 +78,7 @@ class TextHelperTest extends TestCase
     public function tearDown()
     {
         unset($this->Text, $this->View);
-        Configure::write('App.namespace', $this->_appNamespace);
+        static::setAppNamespace($this->_appNamespace);
         parent::tearDown();
     }
 

+ 1 - 2
tests/TestCase/View/ViewBuilderTest.php

@@ -14,7 +14,6 @@
  */
 namespace Cake\Test\TestCase\View;
 
-use Cake\Core\Configure;
 use Cake\TestSuite\TestCase;
 use Cake\View\ViewBuilder;
 
@@ -151,7 +150,7 @@ class ViewBuilderTest extends TestCase
      */
     public function testBuildAppViewMissing()
     {
-        Configure::write('App.namespace', 'Nope');
+        static::setAppNamespace('Nope');
         $builder = new ViewBuilder();
         $view = $builder->build();
         $this->assertInstanceOf('Cake\View\View', $view);

+ 8 - 8
tests/test_app/TestApp/Shell/TestingDispatchShell.php

@@ -17,7 +17,7 @@
 namespace TestApp\Shell;
 
 use Cake\Console\Shell;
-use Cake\Core\Configure;
+use Cake\TestSuite\TestCase;
 
 /**
  * for testing dispatchShell functionality
@@ -38,35 +38,35 @@ class TestingDispatchShell extends Shell
     public function testTask()
     {
         $this->out('I am a test task, I dispatch another Shell');
-        Configure::write('App.namespace', 'TestApp');
+        TestCase::setAppNamespace();
         $this->dispatchShell('testing_dispatch dispatch_test_task');
     }
 
     public function testTaskDispatchArray()
     {
         $this->out('I am a test task, I dispatch another Shell');
-        Configure::write('App.namespace', 'TestApp');
+        TestCase::setAppNamespace();
         $this->dispatchShell('testing_dispatch', 'dispatch_test_task');
     }
 
     public function testTaskDispatchCommandString()
     {
         $this->out('I am a test task, I dispatch another Shell');
-        Configure::write('App.namespace', 'TestApp');
+        TestCase::setAppNamespace();
         $this->dispatchShell(['command' => 'testing_dispatch dispatch_test_task']);
     }
 
     public function testTaskDispatchCommandArray()
     {
         $this->out('I am a test task, I dispatch another Shell');
-        Configure::write('App.namespace', 'TestApp');
+        TestCase::setAppNamespace();
         $this->dispatchShell(['command' => ['testing_dispatch', 'dispatch_test_task']]);
     }
 
     public function testTaskDispatchWithParam()
     {
         $this->out('I am a test task, I dispatch another Shell');
-        Configure::write('App.namespace', 'TestApp');
+        TestCase::setAppNamespace();
         $this->dispatchShell([
             'command' => ['testing_dispatch', 'dispatch_test_task_param'],
             'extra' => [
@@ -78,7 +78,7 @@ class TestingDispatchShell extends Shell
     public function testTaskDispatchWithMultipleParams()
     {
         $this->out('I am a test task, I dispatch another Shell');
-        Configure::write('App.namespace', 'TestApp');
+        TestCase::setAppNamespace();
         $this->dispatchShell([
             'command' => 'testing_dispatch dispatch_test_task_params',
             'extra' => [
@@ -91,7 +91,7 @@ class TestingDispatchShell extends Shell
     public function testTaskDispatchWithRequestedOff()
     {
         $this->out('I am a test task, I dispatch another Shell');
-        Configure::write('App.namespace', 'TestApp');
+        TestCase::setAppNamespace();
         $this->dispatchShell([
             'command' => ['testing_dispatch', 'dispatch_test_task'],
             'extra' => [