Skip to content

Commit

Permalink
Update test case Model folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed May 26, 2012
1 parent 540922a commit 21a3e8f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Test/TestCase/Model/AclNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public function testNodeAliasParenting() {
*/
public function testNodeActionAuthorize() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
), App::RESET);
CakePlugin::load('TestPlugin');

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/TestCase/Model/BehaviorCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public function testLoadAlias() {
$this->assertEquals('working', $Apple->testMethod(true));
$this->assertEquals('working', $Apple->Behaviors->dispatchMethod($Apple, 'testMethod'));

App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)));
App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)));
CakePlugin::load('TestPlugin');
$this->assertTrue($Apple->Behaviors->load('SomeOther', array('className' => 'TestPlugin.TestPluginPersisterOne')));
$this->assertInstanceOf('TestPluginPersisterOneBehavior', $Apple->Behaviors->SomeOther);
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/TestCase/Model/CakeSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public function testSchemaReadWithConfigPrefix() {
public function testSchemaReadWithPlugins() {
App::objects('model', null, false);
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
));
CakePlugin::load('TestPlugin');

Expand Down Expand Up @@ -1049,7 +1049,7 @@ public function testSchemaLoading() {
*/
public function testSchemaLoadingFromPlugin() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
));
CakePlugin::load('TestPlugin');
$Other = $this->Schema->load(array('name' => 'TestPluginApp', 'plugin' => 'TestPlugin'));
Expand Down
18 changes: 9 additions & 9 deletions lib/Cake/Test/TestCase/Model/ConnectionManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testEnumConnectionObjects() {
public function testGetDataSource() {
App::build(array(
'Model/Datasource' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS
CAKE . 'Test' . DS . 'TestApp' . DS . 'Model' . DS . 'Datasource' . DS
)
));

Expand Down Expand Up @@ -88,7 +88,7 @@ public function testGetDataSourceException() {
*/
public function testGetPluginDataSource() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
), App::RESET);
CakePlugin::load('TestPlugin');
$name = 'test_source';
Expand All @@ -109,7 +109,7 @@ public function testGetPluginDataSource() {
*/
public function testGetPluginDataSourceAndPluginDriver() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
), App::RESET);
CakePlugin::load('TestPlugin');
$name = 'test_plugin_source_and_driver';
Expand All @@ -132,7 +132,7 @@ public function testGetPluginDataSourceAndPluginDriver() {
*/
public function testGetLocalDataSourceAndPluginDriver() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
));
CakePlugin::load('TestPlugin');
$name = 'test_local_source_and_plugin_driver';
Expand All @@ -154,9 +154,9 @@ public function testGetLocalDataSourceAndPluginDriver() {
*/
public function testGetPluginDataSourceAndLocalDriver() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS),
'Model/Datasource/Database' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS . 'Database' . DS
CAKE . 'Test' . DS . 'TestApp' . DS . 'Model' . DS . 'Datasource' . DS . 'Database' . DS
)
));

Expand Down Expand Up @@ -270,9 +270,9 @@ public function testCreateDataSourceWithIntegrationTests() {
*/
public function testConnectionData() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS),
'Model/Datasource' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS
CAKE . 'Test' . DS . 'TestApp' . DS . 'Model' . DS . 'Datasource' . DS
)
), App::RESET);
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
Expand Down Expand Up @@ -332,7 +332,7 @@ public function testConnectionData() {
public function testDrop() {
App::build(array(
'Model/Datasource' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS
CAKE . 'Test' . DS . 'TestApp' . DS . 'Model' . DS . 'Datasource' . DS
)
));
ConnectionManager::create('droppable', array('datasource' => 'Test2Source'));
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/TestCase/Model/Datasource/CakeSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ public function testReadAndWriteWithCakeStorage() {
public function testUsingAppLibsHandler() {
App::build(array(
'Model/Datasource/Session' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS . 'Session' . DS
CAKE . 'Test' . DS . 'TestApp' . DS . 'Model' . DS . 'Datasource' . DS . 'Session' . DS
),
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
), App::RESET);
Configure::write('Session', array(
'defaults' => 'cake',
Expand All @@ -560,7 +560,7 @@ public function testUsingAppLibsHandler() {
*/
public function testUsingPluginHandler() {
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
), App::RESET);
CakePlugin::load('TestPlugin');

Expand Down
13 changes: 8 additions & 5 deletions lib/Cake/Test/TestCase/Model/Datasource/DataSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

App::uses('Model', 'Model');
App::uses('DataSource', 'Model/Datasource');
namespace Cake\Test\TestCase\Model\Datasource;
use Cake\TestSuite\TestCase,
Cake\Model\Model,
Cake\Model\ConnectionManager,
Cake\Model\Datasource\DataSource;

/**
* TestSource
Expand Down Expand Up @@ -94,7 +97,7 @@ public function calculate(Model $Model, $func, $params = array()) {
*
* @package Cake.Test.Case.Model.Datasource
*/
class DataSourceTest extends CakeTestCase {
class DataSourceTest extends TestCase {

/**
* Name of test source
Expand All @@ -111,15 +114,15 @@ class DataSourceTest extends CakeTestCase {
public function setUp() {
parent::setUp();
$this->Source = $this->getMock(
'TestSource',
__NAMESPACE__ . '\TestSource',
array('create', 'read', 'update', 'delete')
);
ConnectionManager::create($this->sourceName, array(
'datasource' => get_class($this->Source),
'apiKey' => '1234abcd',
));
$this->Model = $this->getMock(
'Model',
'Cake\Model\Model',
array('getDataSource'),
array(array('ds' => $this->sourceName))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ public function testAlterSchemaIndexes() {
public function testBlobSaving() {
$this->loadFixtures('BinaryTest');
$this->Dbo->cacheSources = false;
$data = file_get_contents(CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif');
$data = file_get_contents(CAKE . 'Test' . DS . 'TestApp' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif');

$model = new CakeTestModel(array('name' => 'BinaryTest', 'ds' => 'test'));
$model->save(compact('data'));
Expand Down
17 changes: 10 additions & 7 deletions lib/Cake/Test/TestCase/Model/models.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
* @since CakePHP(tm) v 1.2.0.6464
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Model', 'Model');
namespace Cake\Test\TestCase\Model;
use Cake\TestSuite\Fixture\TestModel as CakeTestModel,
Cake\Model\Model;

/**
* AppModel class
*
Expand Down Expand Up @@ -615,7 +618,7 @@ public function afterFind($results, $primary = false) {
*
* @package Cake.Test.Case.Model
*/
class MergeVarPluginAppModel extends AppModel {
class MergeVarPluginAppModel extends Model {

/**
* actsAs parameter
Expand Down Expand Up @@ -4752,7 +4755,7 @@ class ScaffoldMock extends CakeTestModel {
*/
public $belongsTo = array(
'User' => array(
'className' => 'ScaffoldUser',
'className' => 'Cake\Test\TestCase\Model\ScaffoldUser',
'foreignKey' => 'user_id',
)
);
Expand All @@ -4764,7 +4767,7 @@ class ScaffoldMock extends CakeTestModel {
*/
public $hasMany = array(
'Comment' => array(
'className' => 'ScaffoldComment',
'className' => 'Cake\Test\TestCase\Model\ScaffoldComment',
'foreignKey' => 'article_id',
)
);
Expand All @@ -4776,7 +4779,7 @@ class ScaffoldMock extends CakeTestModel {
*/
public $hasAndBelongsToMany = array(
'ScaffoldTag' => array(
'className' => 'ScaffoldTag',
'className' => 'Cake\Test\TestCase\Model\ScaffoldTag',
'foreignKey' => 'something_id',
'associationForeignKey' => 'something_else_id',
'joinTable' => 'join_things'
Expand Down Expand Up @@ -4806,7 +4809,7 @@ class ScaffoldUser extends CakeTestModel {
*/
public $hasMany = array(
'Article' => array(
'className' => 'ScaffoldMock',
'className' => 'Cake\Test\TestCase\Model\ScaffoldMock',
'foreignKey' => 'article_id',
)
);
Expand All @@ -4833,7 +4836,7 @@ class ScaffoldComment extends CakeTestModel {
*/
public $belongsTo = array(
'Article' => array(
'className' => 'ScaffoldMock',
'className' => 'Cake\Test\TestCase\Model\ScaffoldMock',
'foreignKey' => 'article_id',
)
);
Expand Down

0 comments on commit 21a3e8f

Please sign in to comment.