Skip to content
Permalink
Browse files

Replace other literal configure calls with new convenience function s…

…etAppNamespace()
  • Loading branch information...
ravage84 committed Jun 15, 2017
1 parent 3caa498 commit 41671410cbc00b7834e965b474d73a3fd8539bdb
@@ -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 @@ public function testShortName($class, $type, $suffix = '', $expected = false)
*/
public function testShortNameWithNestedAppNamespace()
{
Configure::write('App.namespace', 'TestApp/Nested');
static::setAppNamespace('TestApp/Nested');
$return = TestApp::shortName(
'TestApp/Nested/Controller/PagesController',
@@ -46,8 +46,7 @@ public function setUp()
public function tearDown()
{
parent::tearDown();
Configure::write('App.namespace', $this->appNamespace);
static::setAppNamespace($this->appNamespace);
}
/**
@@ -45,7 +45,7 @@ public function testGetMailer()
static::setAppNamespace();
$stub = new Stub();
$this->assertInstanceOf('TestApp\Mailer\TestMailer', $stub->getMailer('Test'));
Configure::write('App.namespace', $originalAppNamespace);
static::setAppNamespace($originalAppNamespace);
}
/**
@@ -16,7 +16,6 @@
use Cake\Console\ConsoleIo;
use Cake\Console\ConsoleOutput;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\TestSuite\TestCase;
@@ -74,7 +73,7 @@ public function tearDown()
{
parent::tearDown();
unset($this->Shell);
Configure::write('App.namespace', 'App');
static::setAppNamespace('App');
Plugin::unload();
}
@@ -144,7 +144,7 @@ public function setUp()
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);
@@ -74,7 +74,7 @@ public function setUp()
public function tearDown()
{
parent::tearDown();
Configure::write('App.namespace', $this->_appNamespace);
static::setAppNamespace($this->_appNamespace);
unset($this->View);
}
@@ -78,7 +78,7 @@ public function setUp()
public function tearDown()
{
unset($this->Text, $this->View);
Configure::write('App.namespace', $this->_appNamespace);
static::setAppNamespace($this->_appNamespace);
parent::tearDown();
}
@@ -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 @@ public function testBuildComplete()
*/
public function testBuildAppViewMissing()
{
Configure::write('App.namespace', 'Nope');
static::setAppNamespace('Nope');
$builder = new ViewBuilder();
$view = $builder->build();
$this->assertInstanceOf('Cake\View\View', $view);
@@ -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 @@ public function out($message = null, $newlines = 1, $level = Shell::NORMAL)
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 @@ public function testTaskDispatchWithParam()
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 @@ public function testTaskDispatchWithMultipleParams()
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' => [

0 comments on commit 4167141

Please sign in to comment.
You can’t perform that action at this time.