Skip to content
Permalink
Browse files

Fixed few test cases related with namespaces

  • Loading branch information...
jrbasso committed Jun 25, 2012
1 parent 90ee0a4 commit 7917481a9c0f10ea0371e002a08f4c07b0974480
@@ -303,7 +303,7 @@ protected function _bindTextDomain($domain) {
$this->_noLocale = true;
$core = true;
$merge = array();
$searchPaths = App::path('locales');
$searchPaths = App::path('Locale');
$plugins = Plugin::loaded();
if (!empty($plugins)) {
@@ -143,9 +143,6 @@ public function tearDown() {
* Test that ControllerTestCase::generate() creates mock objects correctly
*/
public function testGenerate() {
if (defined('APP_CONTROLLER_EXISTS')) {
$this->markTestSkipped('AppController exists, cannot run.');
}
$Posts = $this->Case->generate(__NAMESPACE__ . '\PostsController');
$this->assertEquals('Posts', $Posts->name);
$this->assertEquals('Post', $Posts->modelClass);
@@ -221,7 +218,7 @@ public function testGenerateWithPlugin() {
$result = ClassRegistry::init('TestPlugin.TestPluginComment');
$this->assertInstanceOf('TestPlugin\Model\TestPluginComment', $result);
$Tests = $this->Case->generate(__NAMESPACE__ . '\ControllerTestCaseTest', array(
$Tests = $this->Case->generate(__NAMESPACE__ . '\ControllerTestCaseTestController', array(
'models' => array(
'TestPlugin.TestPluginComment' => array('save')
)
@@ -173,17 +173,17 @@ class ClassRegistryTest extends TestCase {
* @return void
*/
public function testAddModel() {
$Tag = ClassRegistry::init('RegisterArticleTag');
$this->assertTrue(is_a($Tag, 'RegisterArticleTag'));
$Tag = ClassRegistry::init(__NAMESPACE__ . '\RegisterArticleTag');
$this->assertInstanceOf(__NAMESPACE__ . '\RegisterArticleTag', $Tag);
$TagCopy = ClassRegistry::isKeySet('RegisterArticleTag');
$TagCopy = ClassRegistry::isKeySet(__NAMESPACE__ . '\RegisterArticleTag');
$this->assertTrue($TagCopy);
$Tag->name = 'SomeNewName';
$TagCopy = ClassRegistry::getObject('RegisterArticleTag');
$TagCopy = ClassRegistry::getObject(__NAMESPACE__ . '\RegisterArticleTag');
$this->assertTrue(is_a($TagCopy, 'RegisterArticleTag'));
$this->assertInstanceOf(__NAMESPACE__ . '\RegisterArticleTag', $TagCopy);
$this->assertSame($Tag, $TagCopy);
$NewTag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
@@ -311,16 +311,16 @@ public function testPluginAppModel() {
*/
public function testPrefixedTestDatasource() {
ClassRegistry::config(array('testing' => true));
$Model = ClassRegistry::init('RegisterPrefixedDs');
$Model = ClassRegistry::init(__NAMESPACE__ . '\RegisterPrefixedDs');
$this->assertEquals('test', $Model->useDbConfig);
ClassRegistry::removeObject('RegisterPrefixedDs');
ClassRegistry::removeObject(__NAMESPACE__ . '\RegisterPrefixedDs');
$testConfig = ConnectionManager::getDataSource('test')->config;
ConnectionManager::create('test_doesnotexist', $testConfig);
$Model = ClassRegistry::init('RegisterArticle');
$Model = ClassRegistry::init(__NAMESPACE__ . '\RegisterArticle');
$this->assertEquals('test', $Model->useDbConfig);
$Model = ClassRegistry::init('RegisterPrefixedDs');
$Model = ClassRegistry::init(__NAMESPACE__ . '\RegisterPrefixedDs');
$this->assertEquals('test_doesnotexist', $Model->useDbConfig);
}
@@ -339,7 +339,7 @@ public function testInitStrict() {
* @return void
*/
public function testInitAbstractClass() {
ClassRegistry::init('ClassRegistryAbstractModel');
ClassRegistry::init(__NAMESPACE__ . '\ClassRegistryAbstractModel');
}
/**
@@ -349,6 +349,6 @@ public function testInitAbstractClass() {
* @return void
*/
public function testInitInterface() {
ClassRegistry::init('ClassRegistryInterfaceTest');
ClassRegistry::init(__NAMESPACE__ . '\ClassRegistryInterfaceTest');
}
}
@@ -925,7 +925,7 @@ public function testLazyLoadingHelpers() {
public function testThatHelperHelpersAreNotAttached() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS),
));
), App::RESET);
Plugin::loadAll();
$Helper = new TestHelper($this->View);
@@ -65,7 +65,7 @@ public function __isset($helper) {
try {
$this->load($helper);
} catch (MissingHelperException $exception) {
} catch (Error\MissingHelperException $exception) {
if ($this->_View->plugin) {
$this->load($this->_View->plugin . '.' . $helper);
return true;

0 comments on commit 7917481

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