Skip to content

Commit 4167141

Browse files
committed
Replace other literal configure calls with new convenience function setAppNamespace()
1 parent 3caa498 commit 4167141

File tree

9 files changed

+16
-20
lines changed

9 files changed

+16
-20
lines changed

tests/TestCase/Core/AppTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace Cake\Test\TestCase\Core;
1515

1616
use Cake\Core\App;
17-
use Cake\Core\Configure;
1817
use Cake\Core\Plugin;
1918
use Cake\TestSuite\TestCase;
2019
use TestApp\Core\TestApp;
@@ -93,7 +92,7 @@ public function testShortName($class, $type, $suffix = '', $expected = false)
9392
*/
9493
public function testShortNameWithNestedAppNamespace()
9594
{
96-
Configure::write('App.namespace', 'TestApp/Nested');
95+
static::setAppNamespace('TestApp/Nested');
9796

9897
$return = TestApp::shortName(
9998
'TestApp/Nested/Controller/PagesController',

tests/TestCase/Http/MiddlewareQueueTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public function setUp()
4646
public function tearDown()
4747
{
4848
parent::tearDown();
49-
50-
Configure::write('App.namespace', $this->appNamespace);
49+
static::setAppNamespace($this->appNamespace);
5150
}
5251

5352
/**

tests/TestCase/Mailer/MailerAwareTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testGetMailer()
4545
static::setAppNamespace();
4646
$stub = new Stub();
4747
$this->assertInstanceOf('TestApp\Mailer\TestMailer', $stub->getMailer('Test'));
48-
Configure::write('App.namespace', $originalAppNamespace);
48+
static::setAppNamespace($originalAppNamespace);
4949
}
5050

5151
/**

tests/TestCase/Shell/CompletionShellTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
use Cake\Console\ConsoleIo;
1818
use Cake\Console\ConsoleOutput;
19-
use Cake\Core\Configure;
2019
use Cake\Core\Plugin;
2120
use Cake\TestSuite\TestCase;
2221

@@ -74,7 +73,7 @@ public function tearDown()
7473
{
7574
parent::tearDown();
7675
unset($this->Shell);
77-
Configure::write('App.namespace', 'App');
76+
static::setAppNamespace('App');
7877
Plugin::unload();
7978
}
8079

tests/TestCase/View/Helper/FormHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function setUp()
144144

145145
Configure::write('Config.language', 'eng');
146146
Configure::write('App.base', '');
147-
Configure::write('App.namespace', 'Cake\Test\TestCase\View\Helper');
147+
static::setAppNamespace('Cake\Test\TestCase\View\Helper');
148148
$this->View = new View();
149149

150150
$this->Form = new FormHelper($this->View);

tests/TestCase/View/Helper/NumberHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function setUp()
7474
public function tearDown()
7575
{
7676
parent::tearDown();
77-
Configure::write('App.namespace', $this->_appNamespace);
77+
static::setAppNamespace($this->_appNamespace);
7878
unset($this->View);
7979
}
8080

tests/TestCase/View/Helper/TextHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function setUp()
7878
public function tearDown()
7979
{
8080
unset($this->Text, $this->View);
81-
Configure::write('App.namespace', $this->_appNamespace);
81+
static::setAppNamespace($this->_appNamespace);
8282
parent::tearDown();
8383
}
8484

tests/TestCase/View/ViewBuilderTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515
namespace Cake\Test\TestCase\View;
1616

17-
use Cake\Core\Configure;
1817
use Cake\TestSuite\TestCase;
1918
use Cake\View\ViewBuilder;
2019

@@ -151,7 +150,7 @@ public function testBuildComplete()
151150
*/
152151
public function testBuildAppViewMissing()
153152
{
154-
Configure::write('App.namespace', 'Nope');
153+
static::setAppNamespace('Nope');
155154
$builder = new ViewBuilder();
156155
$view = $builder->build();
157156
$this->assertInstanceOf('Cake\View\View', $view);

tests/test_app/TestApp/Shell/TestingDispatchShell.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace TestApp\Shell;
1818

1919
use Cake\Console\Shell;
20-
use Cake\Core\Configure;
20+
use Cake\TestSuite\TestCase;
2121

2222
/**
2323
* for testing dispatchShell functionality
@@ -38,35 +38,35 @@ public function out($message = null, $newlines = 1, $level = Shell::NORMAL)
3838
public function testTask()
3939
{
4040
$this->out('I am a test task, I dispatch another Shell');
41-
Configure::write('App.namespace', 'TestApp');
41+
TestCase::setAppNamespace();
4242
$this->dispatchShell('testing_dispatch dispatch_test_task');
4343
}
4444

4545
public function testTaskDispatchArray()
4646
{
4747
$this->out('I am a test task, I dispatch another Shell');
48-
Configure::write('App.namespace', 'TestApp');
48+
TestCase::setAppNamespace();
4949
$this->dispatchShell('testing_dispatch', 'dispatch_test_task');
5050
}
5151

5252
public function testTaskDispatchCommandString()
5353
{
5454
$this->out('I am a test task, I dispatch another Shell');
55-
Configure::write('App.namespace', 'TestApp');
55+
TestCase::setAppNamespace();
5656
$this->dispatchShell(['command' => 'testing_dispatch dispatch_test_task']);
5757
}
5858

5959
public function testTaskDispatchCommandArray()
6060
{
6161
$this->out('I am a test task, I dispatch another Shell');
62-
Configure::write('App.namespace', 'TestApp');
62+
TestCase::setAppNamespace();
6363
$this->dispatchShell(['command' => ['testing_dispatch', 'dispatch_test_task']]);
6464
}
6565

6666
public function testTaskDispatchWithParam()
6767
{
6868
$this->out('I am a test task, I dispatch another Shell');
69-
Configure::write('App.namespace', 'TestApp');
69+
TestCase::setAppNamespace();
7070
$this->dispatchShell([
7171
'command' => ['testing_dispatch', 'dispatch_test_task_param'],
7272
'extra' => [
@@ -78,7 +78,7 @@ public function testTaskDispatchWithParam()
7878
public function testTaskDispatchWithMultipleParams()
7979
{
8080
$this->out('I am a test task, I dispatch another Shell');
81-
Configure::write('App.namespace', 'TestApp');
81+
TestCase::setAppNamespace();
8282
$this->dispatchShell([
8383
'command' => 'testing_dispatch dispatch_test_task_params',
8484
'extra' => [
@@ -91,7 +91,7 @@ public function testTaskDispatchWithMultipleParams()
9191
public function testTaskDispatchWithRequestedOff()
9292
{
9393
$this->out('I am a test task, I dispatch another Shell');
94-
Configure::write('App.namespace', 'TestApp');
94+
TestCase::setAppNamespace();
9595
$this->dispatchShell([
9696
'command' => ['testing_dispatch', 'dispatch_test_task'],
9797
'extra' => [

0 commit comments

Comments
 (0)