mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-04 07:03:41 +02:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
@ -2,23 +2,24 @@
|
|||
/**
|
||||
* ModelIntegrationTest file
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Case.Model
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . DS . 'ModelTestBase.php';
|
||||
|
||||
App::uses('DboSource', 'Model/Datasource');
|
||||
App::uses('DboMock', 'Model/Datasource');
|
||||
|
||||
/**
|
||||
* DboMock class
|
||||
|
@ -28,6 +29,8 @@ class DboMock extends DboSource {
|
|||
|
||||
/**
|
||||
* Returns the $field without modifications
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function name($field) {
|
||||
return $field;
|
||||
|
@ -35,6 +38,8 @@ class DboMock extends DboSource {
|
|||
|
||||
/**
|
||||
* Returns true to fake a database connection
|
||||
*
|
||||
* @return bool true
|
||||
*/
|
||||
public function connect() {
|
||||
return true;
|
||||
|
@ -155,17 +160,17 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that $cacheSources can only be disabled in the db using model settings, not enabled
|
||||
* Tests that $cacheSources is restored despite the settings on the model.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCacheSourcesDisabling() {
|
||||
public function testCacheSourcesRestored() {
|
||||
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC');
|
||||
$this->db->cacheSources = true;
|
||||
$TestModel = new JoinA();
|
||||
$TestModel->cacheSources = false;
|
||||
$TestModel->setSource('join_as');
|
||||
$this->assertFalse($this->db->cacheSources);
|
||||
$this->assertTrue($this->db->cacheSources);
|
||||
|
||||
$this->db->cacheSources = false;
|
||||
$TestModel = new JoinA();
|
||||
|
@ -208,11 +213,11 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
public function testDynamicBehaviorAttachment() {
|
||||
$this->loadFixtures('Apple', 'Sample', 'Author');
|
||||
$TestModel = new Apple();
|
||||
$this->assertEquals(array(), $TestModel->Behaviors->attached());
|
||||
$this->assertEquals(array(), $TestModel->Behaviors->loaded());
|
||||
|
||||
$TestModel->Behaviors->attach('Tree', array('left' => 'left_field', 'right' => 'right_field'));
|
||||
$TestModel->Behaviors->load('Tree', array('left' => 'left_field', 'right' => 'right_field'));
|
||||
$this->assertTrue(is_object($TestModel->Behaviors->Tree));
|
||||
$this->assertEquals(array('Tree'), $TestModel->Behaviors->attached());
|
||||
$this->assertEquals(array('Tree'), $TestModel->Behaviors->loaded());
|
||||
|
||||
$expected = array(
|
||||
'parent' => 'parent_id',
|
||||
|
@ -221,23 +226,49 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'scope' => '1 = 1',
|
||||
'type' => 'nested',
|
||||
'__parentChange' => false,
|
||||
'recursive' => -1
|
||||
'recursive' => -1,
|
||||
'level' => null
|
||||
);
|
||||
$this->assertEquals($expected, $TestModel->Behaviors->Tree->settings['Apple']);
|
||||
|
||||
$TestModel->Behaviors->attach('Tree', array('enabled' => false));
|
||||
$TestModel->Behaviors->load('Tree', array('enabled' => false));
|
||||
$this->assertEquals($expected, $TestModel->Behaviors->Tree->settings['Apple']);
|
||||
$this->assertEquals(array('Tree'), $TestModel->Behaviors->attached());
|
||||
$this->assertEquals(array('Tree'), $TestModel->Behaviors->loaded());
|
||||
|
||||
$TestModel->Behaviors->detach('Tree');
|
||||
$this->assertEquals(array(), $TestModel->Behaviors->attached());
|
||||
$TestModel->Behaviors->unload('Tree');
|
||||
$this->assertEquals(array(), $TestModel->Behaviors->loaded());
|
||||
$this->assertFalse(isset($TestModel->Behaviors->Tree));
|
||||
}
|
||||
|
||||
/**
|
||||
* testTreeWithContainable method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testTreeWithContainable() {
|
||||
$this->loadFixtures('Ad', 'Campaign');
|
||||
$TestModel = new Ad();
|
||||
$TestModel->Behaviors->load('Tree');
|
||||
$TestModel->Behaviors->load('Containable');
|
||||
|
||||
$node = $TestModel->findById(2);
|
||||
$node['Ad']['parent_id'] = 1;
|
||||
$TestModel->save($node);
|
||||
|
||||
$result = $TestModel->getParentNode(array('id' => 2, 'contain' => 'Campaign'));
|
||||
$this->assertTrue(array_key_exists('Campaign', $result));
|
||||
|
||||
$result = $TestModel->children(array('id' => 1, 'contain' => 'Campaign'));
|
||||
$this->assertTrue(array_key_exists('Campaign', $result[0]));
|
||||
|
||||
$result = $TestModel->getPath(array('id' => 2, 'contain' => 'Campaign'));
|
||||
$this->assertTrue(array_key_exists('Campaign', $result[0]));
|
||||
$this->assertTrue(array_key_exists('Campaign', $result[1]));
|
||||
}
|
||||
|
||||
/**
|
||||
* testFindWithJoinsOption method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function testFindWithJoinsOption() {
|
||||
|
@ -274,9 +305,11 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests cross database joins. Requires $test and $test2 to both be set in DATABASE_CONFIG
|
||||
* Tests cross database joins. Requires $test and $test2 to both be set in DATABASE_CONFIG
|
||||
* NOTE: When testing on MySQL, you must set 'persistent' => false on *both* database connections,
|
||||
* or one connection will step on the other.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCrossDatabaseJoins() {
|
||||
$config = ConnectionManager::enumConnectionObjects();
|
||||
|
@ -284,7 +317,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$skip = (!isset($config['test']) || !isset($config['test2']));
|
||||
if ($skip) {
|
||||
$this->markTestSkipped('Primary and secondary test databases not configured, skipping cross-database
|
||||
join tests. To run theses tests defined $test and $test2 in your database configuration.'
|
||||
join tests. To run theses tests defined $test and $test2 in your database configuration.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -815,7 +848,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
||||
$this->skipIf(
|
||||
!isset($config['test']) || !isset($config['test2']) || !isset($config['test_database_three']),
|
||||
'Primary, secondary, and tertiary test databases not configured, skipping test. To run this test define $test, $test2, and $test_database_three in your database configuration.'
|
||||
'Primary, secondary, and tertiary test databases not configured, skipping test. To run this test define $test, $test2, and $test_database_three in your database configuration.'
|
||||
);
|
||||
|
||||
$this->loadFixtures('Player', 'Guild', 'GuildsPlayer', 'Armor', 'ArmorsPlayer');
|
||||
|
@ -835,16 +868,16 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$this->assertEquals('test_database_three', $Player->ArmorsPlayer->useDbConfig);
|
||||
|
||||
$players = $Player->find('all');
|
||||
$this->assertEquals(4 , count($players));
|
||||
$this->assertEquals(4, count($players));
|
||||
$playersGuilds = Hash::extract($players, '{n}.Guild.{n}.GuildsPlayer');
|
||||
$this->assertEquals(3 , count($playersGuilds));
|
||||
$this->assertEquals(3, count($playersGuilds));
|
||||
$playersArmors = Hash::extract($players, '{n}.Armor.{n}.ArmorsPlayer');
|
||||
$this->assertEquals(3 , count($playersArmors));
|
||||
$this->assertEquals(3, count($playersArmors));
|
||||
unset($players);
|
||||
|
||||
$larry = $Player->findByName('larry');
|
||||
$larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer');
|
||||
$this->assertEquals(1 , count($larrysArmor));
|
||||
$this->assertEquals(1, count($larrysArmor));
|
||||
|
||||
$larry['Guild']['Guild'] = array(1, 3); // larry joins another guild
|
||||
$larry['Armor']['Armor'] = array(2, 3); // purchases chainmail
|
||||
|
@ -853,11 +886,9 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
|
||||
$larry = $Player->findByName('larry');
|
||||
$larrysGuild = Hash::extract($larry, 'Guild.{n}.GuildsPlayer');
|
||||
$this->assertEquals(2 , count($larrysGuild));
|
||||
$this->assertEquals(2, count($larrysGuild));
|
||||
$larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer');
|
||||
$this->assertEquals(2 , count($larrysArmor));
|
||||
|
||||
$larrysArmorsPlayersIds = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer.id');
|
||||
$this->assertEquals(2, count($larrysArmor));
|
||||
|
||||
$Player->ArmorsPlayer->id = 3;
|
||||
$Player->ArmorsPlayer->saveField('broken', true); // larry's cloak broke
|
||||
|
@ -1303,7 +1334,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$Article->useTable = false;
|
||||
$Article->id = 1;
|
||||
$result = $Article->exists();
|
||||
$this->assertTrue($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1441,7 +1472,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
|
||||
$assocTypes = array('hasMany', 'hasOne', 'belongsTo', 'hasAndBelongsToMany');
|
||||
foreach ($assocTypes as $type) {
|
||||
$this->assertEquals($Article->getAssociated($type), array_keys($Article->{$type}));
|
||||
$this->assertEquals($Article->getAssociated($type), array_keys($Article->{$type}));
|
||||
}
|
||||
|
||||
$Article->bindModel(array('hasMany' => array('Category')));
|
||||
|
@ -1492,7 +1523,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'dynamicWith' => true,
|
||||
'associationForeignKey' => 'join_b_id',
|
||||
'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '',
|
||||
'finderQuery' => '', 'deleteQuery' => '', 'insertQuery' => ''
|
||||
'finderQuery' => ''
|
||||
));
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
@ -1509,8 +1540,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'conditions' => '', 'fields' => '', 'order' => '', 'counterCache' => ''
|
||||
)
|
||||
);
|
||||
$this->assertSame($TestModel->belongsTo, $expected);
|
||||
$this->assertSame($TestFakeModel->belongsTo, $expected);
|
||||
$this->assertSame($expected, $TestModel->belongsTo);
|
||||
$this->assertSame($expected, $TestFakeModel->belongsTo);
|
||||
|
||||
$this->assertEquals('User', $TestModel->User->name);
|
||||
$this->assertEquals('User', $TestFakeModel->User->name);
|
||||
|
@ -1527,8 +1558,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'dependent' => ''
|
||||
));
|
||||
|
||||
$this->assertSame($TestModel->hasOne, $expected);
|
||||
$this->assertSame($TestFakeModel->hasOne, $expected);
|
||||
$this->assertSame($expected, $TestModel->hasOne);
|
||||
$this->assertSame($expected, $TestFakeModel->hasOne);
|
||||
|
||||
$this->assertEquals('Featured', $TestModel->Featured->name);
|
||||
$this->assertEquals('Featured', $TestFakeModel->Featured->name);
|
||||
|
@ -1548,8 +1579,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'counterQuery' => ''
|
||||
));
|
||||
|
||||
$this->assertSame($TestModel->hasMany, $expected);
|
||||
$this->assertSame($TestFakeModel->hasMany, $expected);
|
||||
$this->assertSame($expected, $TestModel->hasMany);
|
||||
$this->assertSame($expected, $TestFakeModel->hasMany);
|
||||
|
||||
$this->assertEquals('Comment', $TestModel->Comment->name);
|
||||
$this->assertEquals('Comment', $TestFakeModel->Comment->name);
|
||||
|
@ -1569,12 +1600,10 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'offset' => '',
|
||||
'unique' => true,
|
||||
'finderQuery' => '',
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
));
|
||||
|
||||
$this->assertSame($TestModel->hasAndBelongsToMany, $expected);
|
||||
$this->assertSame($TestFakeModel->hasAndBelongsToMany, $expected);
|
||||
$this->assertSame($expected, $TestModel->hasAndBelongsToMany);
|
||||
$this->assertSame($expected, $TestFakeModel->hasAndBelongsToMany);
|
||||
|
||||
$this->assertEquals('Tag', $TestModel->Tag->name);
|
||||
$this->assertEquals('Tag', $TestFakeModel->Tag->name);
|
||||
|
@ -1588,10 +1617,12 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
public function testAutoConstructPluginAssociations() {
|
||||
$Comment = ClassRegistry::init('TestPluginComment');
|
||||
|
||||
$this->assertEquals(2, count($Comment->belongsTo), 'Too many associations');
|
||||
$this->assertEquals(3, count($Comment->belongsTo), 'Too many associations');
|
||||
$this->assertFalse(isset($Comment->belongsTo['TestPlugin.User']));
|
||||
$this->assertFalse(isset($Comment->belongsTo['TestPlugin.Source']));
|
||||
$this->assertTrue(isset($Comment->belongsTo['User']), 'Missing association');
|
||||
$this->assertTrue(isset($Comment->belongsTo['TestPluginArticle']), 'Missing association');
|
||||
$this->assertTrue(isset($Comment->belongsTo['Source']), 'Missing association');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1681,6 +1712,14 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$result = $TestModel->alias;
|
||||
$expected = 'AnotherTest';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$TestModel = ClassRegistry::init('Test');
|
||||
$expected = null;
|
||||
$this->assertEquals($expected, $TestModel->plugin);
|
||||
|
||||
$TestModel = ClassRegistry::init('TestPlugin.TestPluginComment');
|
||||
$expected = 'TestPlugin';
|
||||
$this->assertEquals($expected, $TestModel->plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1701,7 +1740,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'body' => 'First Post Body',
|
||||
'published' => 'Y',
|
||||
'created' => '2007-03-18 10:39:23',
|
||||
'updated' => '2007-03-18 10:41:31'
|
||||
'updated' => '2007-03-18 10:41:31',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'Something' => array(
|
||||
array(
|
||||
|
@ -1717,7 +1757,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'something_else_id' => '1',
|
||||
'doomed' => true,
|
||||
'created' => '2007-03-18 10:43:23',
|
||||
'updated' => '2007-03-18 10:45:31'
|
||||
'updated' => '2007-03-18 10:45:31',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
)))),
|
||||
array(
|
||||
'SomethingElse' => array(
|
||||
|
@ -1726,7 +1767,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'body' => 'Second Post Body',
|
||||
'published' => 'Y',
|
||||
'created' => '2007-03-18 10:41:23',
|
||||
'updated' => '2007-03-18 10:43:31'
|
||||
'updated' => '2007-03-18 10:43:31',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'Something' => array(
|
||||
array(
|
||||
|
@ -1742,7 +1784,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'something_else_id' => '2',
|
||||
'doomed' => true,
|
||||
'created' => '2007-03-18 10:39:23',
|
||||
'updated' => '2007-03-18 10:41:31'
|
||||
'updated' => '2007-03-18 10:41:31',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
)))),
|
||||
array(
|
||||
'SomethingElse' => array(
|
||||
|
@ -1751,7 +1794,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'body' => 'Third Post Body',
|
||||
'published' => 'Y',
|
||||
'created' => '2007-03-18 10:43:23',
|
||||
'updated' => '2007-03-18 10:45:31'
|
||||
'updated' => '2007-03-18 10:45:31',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'Something' => array(
|
||||
array(
|
||||
|
@ -1767,7 +1811,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'something_else_id' => '3',
|
||||
'doomed' => false,
|
||||
'created' => '2007-03-18 10:41:23',
|
||||
'updated' => '2007-03-18 10:43:31'
|
||||
'updated' => '2007-03-18 10:43:31',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
)))));
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
@ -1793,8 +1838,11 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'JoinThing' => array(
|
||||
'doomed' => true,
|
||||
'something_id' => '1',
|
||||
'something_else_id' => '2'
|
||||
)))),
|
||||
'something_else_id' => '2',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
))),
|
||||
array(
|
||||
'Something' => array(
|
||||
'id' => '2',
|
||||
|
@ -1815,8 +1863,11 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'JoinThing' => array(
|
||||
'doomed' => false,
|
||||
'something_id' => '2',
|
||||
'something_else_id' => '3'
|
||||
)))),
|
||||
'something_else_id' => '3',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
))),
|
||||
array(
|
||||
'Something' => array(
|
||||
'id' => '3',
|
||||
|
@ -1837,8 +1888,11 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'JoinThing' => array(
|
||||
'doomed' => true,
|
||||
'something_id' => '3',
|
||||
'something_else_id' => '1'
|
||||
)))));
|
||||
'something_else_id' => '1',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
))));
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $TestModel->findById(1);
|
||||
|
@ -1862,8 +1916,11 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'JoinThing' => array(
|
||||
'doomed' => true,
|
||||
'something_id' => '1',
|
||||
'something_else_id' => '2'
|
||||
))));
|
||||
'something_else_id' => '2',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
)));
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = $TestModel->findById(1);
|
||||
|
@ -1903,8 +1960,10 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'JoinThing' => array(
|
||||
'doomed' => true,
|
||||
'something_id' => '1',
|
||||
'something_else_id' => '1'
|
||||
)
|
||||
'something_else_id' => '1',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
array(
|
||||
'id' => '2',
|
||||
|
@ -1916,8 +1975,10 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'JoinThing' => array(
|
||||
'doomed' => true,
|
||||
'something_id' => '1',
|
||||
'something_else_id' => '2'
|
||||
)
|
||||
'something_else_id' => '2',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
array(
|
||||
'id' => '3',
|
||||
|
@ -1929,11 +1990,13 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'JoinThing' => array(
|
||||
'doomed' => false,
|
||||
'something_id' => '1',
|
||||
'something_else_id' => '3')
|
||||
)
|
||||
'something_else_id' => '3',
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
),
|
||||
'afterFind' => 'Successfully added by AfterFind'
|
||||
)
|
||||
);
|
||||
$this->assertEquals(self::date(), $result['Something']['updated']);
|
||||
));
|
||||
$this->assertEquals(static::date(), $result['Something']['updated']);
|
||||
unset($result['Something']['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
@ -2175,7 +2238,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
} else {
|
||||
$intLength = 11;
|
||||
}
|
||||
foreach (array('collate', 'charset', 'comment') as $type) {
|
||||
foreach (array('collate', 'charset', 'comment', 'unsigned') as $type) {
|
||||
foreach ($result as $i => $r) {
|
||||
unset($result[$i][$type]);
|
||||
}
|
||||
|
@ -2359,7 +2422,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$config = ConnectionManager::enumConnectionObjects();
|
||||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
||||
$this->skipIf(!isset($config['test']) || !isset($config['test2']),
|
||||
'Primary and secondary test databases not configured, skipping cross-database join tests. To run these tests define $test and $test2 in your database configuration.'
|
||||
'Primary and secondary test databases not configured, skipping cross-database join tests. To run these tests define $test and $test2 in your database configuration.'
|
||||
);
|
||||
|
||||
$this->loadFixtures('Player', 'Guild', 'GuildsPlayer');
|
||||
|
@ -2389,7 +2452,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
||||
$this->skipIf(
|
||||
!isset($config['test']) || !isset($config['test2']) || !isset($config['test_database_three']),
|
||||
'Primary, secondary, and tertiary test databases not configured, skipping test. To run this test define $test, $test2, and $test_database_three in your database configuration.'
|
||||
'Primary, secondary, and tertiary test databases not configured, skipping test. To run this test define $test, $test2, and $test_database_three in your database configuration.'
|
||||
);
|
||||
|
||||
$this->loadFixtures('Player', 'Guild', 'GuildsPlayer', 'Armor', 'ArmorsPlayer');
|
||||
|
@ -2430,11 +2493,24 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
* does not trigger any calls on any datasource
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
*/
|
||||
public function testSchemaNoDB() {
|
||||
$model = $this->getMock('Article', array('getDataSource'));
|
||||
$model->useTable = false;
|
||||
$model->expects($this->never())->method('getDataSource');
|
||||
$this->assertEmpty($model->schema());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that calling getColumnType() on a model that is not supposed to use a table
|
||||
* does not trigger any calls on any datasource
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetColumnTypeNoDB() {
|
||||
$model = $this->getMock('Example', array('getDataSource'));
|
||||
$model->expects($this->never())->method('getDataSource');
|
||||
$result = $model->getColumnType('filefield');
|
||||
$this->assertEquals('string', $result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue