mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Updating test cases
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5910 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a87a0e2a68
commit
fed7d601a2
3 changed files with 43 additions and 45 deletions
|
@ -38,7 +38,7 @@ uses('model'.DS.'model', 'model'.DS.'datasources'.DS.'datasource',
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel extends Model {
|
||||
class TestModel extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel';
|
||||
var $useTable = false;
|
||||
|
@ -80,7 +80,7 @@ class TestModel extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel2 extends Model {
|
||||
class TestModel2 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel2';
|
||||
var $useTable = false;
|
||||
|
@ -91,7 +91,7 @@ class TestModel2 extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel3 extends Model {
|
||||
class TestModel3 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel3';
|
||||
var $useTable = false;
|
||||
|
@ -102,7 +102,7 @@ class TestModel3 extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel4 extends Model {
|
||||
class TestModel4 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel4';
|
||||
var $table = 'test_model4';
|
||||
|
@ -148,7 +148,7 @@ class TestModel4 extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel5 extends Model {
|
||||
class TestModel5 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel5';
|
||||
var $table = 'test_model5';
|
||||
|
@ -183,7 +183,7 @@ class TestModel5 extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel6 extends Model {
|
||||
class TestModel6 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel6';
|
||||
var $table = 'test_model6';
|
||||
|
@ -214,7 +214,7 @@ class TestModel6 extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel7 extends Model {
|
||||
class TestModel7 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel7';
|
||||
var $table = 'test_model7';
|
||||
|
@ -238,7 +238,7 @@ class TestModel7 extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel8 extends Model {
|
||||
class TestModel8 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel8';
|
||||
var $table = 'test_model8';
|
||||
|
@ -272,7 +272,7 @@ class TestModel8 extends Model {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class TestModel9 extends Model {
|
||||
class TestModel9 extends CakeTestModel {
|
||||
|
||||
var $name = 'TestModel9';
|
||||
var $table = 'test_model9';
|
||||
|
@ -299,7 +299,8 @@ class TestModel9 extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class Level extends Model {
|
||||
class Level extends CakeTestModel {
|
||||
|
||||
var $name = 'Level';
|
||||
var $table = 'level';
|
||||
var $useTable = false;
|
||||
|
@ -324,25 +325,15 @@ class Level extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class Group extends Model {
|
||||
class Group extends CakeTestModel {
|
||||
|
||||
var $name = 'Group';
|
||||
var $table = 'group';
|
||||
var $useTable = false;
|
||||
|
||||
var $belongsTo = array(
|
||||
'Level' => array(
|
||||
'className' => 'Level'
|
||||
)
|
||||
);
|
||||
var $belongsTo = array('Level');
|
||||
|
||||
var $hasMany = array(
|
||||
'Category2'=> array(
|
||||
'className' => 'Category2'
|
||||
),
|
||||
'User2'=> array(
|
||||
'className' => 'User2'
|
||||
)
|
||||
);
|
||||
var $hasMany = array('Category2', 'User2');
|
||||
|
||||
function loadInfo() {
|
||||
if (!isset($this->_tableInfo)) {
|
||||
|
@ -356,7 +347,8 @@ class Group extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class User2 extends Model {
|
||||
class User2 extends CakeTestModel {
|
||||
|
||||
var $name = 'User2';
|
||||
var $table = 'user';
|
||||
var $useTable = false;
|
||||
|
@ -389,7 +381,7 @@ class User2 extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class Category2 extends Model {
|
||||
class Category2 extends CakeTestModel {
|
||||
var $name = 'Category2';
|
||||
var $table = 'category';
|
||||
var $useTable = false;
|
||||
|
@ -432,7 +424,7 @@ class Category2 extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class Article2 extends Model {
|
||||
class Article2 extends CakeTestModel {
|
||||
var $name = 'Article2';
|
||||
var $table = 'article';
|
||||
var $useTable = false;
|
||||
|
@ -474,7 +466,7 @@ class Article2 extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class CategoryFeatured2 extends Model {
|
||||
class CategoryFeatured2 extends CakeTestModel {
|
||||
var $name = 'CategoryFeatured2';
|
||||
var $table = 'category_featured';
|
||||
var $useTable = false;
|
||||
|
@ -493,7 +485,7 @@ class CategoryFeatured2 extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class Featured2 extends Model {
|
||||
class Featured2 extends CakeTestModel {
|
||||
|
||||
var $name = 'Featured2';
|
||||
var $table = 'featured2';
|
||||
|
@ -518,7 +510,7 @@ class Featured2 extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class Comment2 extends Model {
|
||||
class Comment2 extends CakeTestModel {
|
||||
var $name = 'Comment2';
|
||||
var $table = 'comment';
|
||||
var $belongsTo = array('ArticleFeatured2', 'User2');
|
||||
|
@ -537,7 +529,7 @@ class Comment2 extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
class ArticleFeatured2 extends Model {
|
||||
class ArticleFeatured2 extends CakeTestModel {
|
||||
var $name = 'ArticleFeatured2';
|
||||
var $table = 'article_featured';
|
||||
var $useTable = false;
|
||||
|
@ -605,7 +597,13 @@ class DboSourceTest extends UnitTestCase {
|
|||
function setUp() {
|
||||
config('database');
|
||||
$config = new DATABASE_CONFIG();
|
||||
$this->db =& new DboTest($config->default);
|
||||
if (isset($config->test)) {
|
||||
$config = $config->test;
|
||||
} else {
|
||||
$config = $config->default;
|
||||
}
|
||||
|
||||
$this->db =& new DboTest($config);
|
||||
$this->db->fullDebug = false;
|
||||
$this->model = new TestModel();
|
||||
$db =& ConnectionManager::getDataSource($this->model->useDbConfig);
|
||||
|
|
|
@ -412,7 +412,7 @@ class DeviceType extends CakeTestModel {
|
|||
'Image' => array('className' => 'Document'),
|
||||
'Extra1' => array('className' => 'Document'),
|
||||
'Extra2' => array('className' => 'Document'));
|
||||
var $hasMany = array('Device' => array('order' => array('Device.typ' => 'ASC')));
|
||||
var $hasMany = array('Device' => array('order' => array('Device.id' => 'ASC')));
|
||||
}
|
||||
class DeviceTypeCategory extends CakeTestModel {
|
||||
var $name = 'DeviceTypeCategory';
|
||||
|
@ -447,6 +447,7 @@ class SecondaryModel extends CakeTestModel {
|
|||
* @subpackage cake.tests.cases.libs.model
|
||||
*/
|
||||
class ModelTest extends CakeTestCase {
|
||||
|
||||
var $fixtures = array(
|
||||
'core.category', 'core.category_thread', 'core.user', 'core.article', 'core.featured', 'core.article_featureds_tags',
|
||||
'core.article_featured', 'core.articles', 'core.tag', 'core.articles_tag', 'core.comment', 'core.attachment',
|
||||
|
@ -455,7 +456,7 @@ class ModelTest extends CakeTestCase {
|
|||
'core.portfolio', 'core.item', 'core.items_portfolio', 'core.syfile', 'core.image',
|
||||
'core.device_type', 'core.device_type_category', 'core.feature_set', 'core.exterior_type_category', 'core.document', 'core.device', 'core.document_directory',
|
||||
'core.primary_model', 'core.secondary_model'
|
||||
);
|
||||
);
|
||||
|
||||
function start() {
|
||||
parent::start();
|
||||
|
@ -582,7 +583,8 @@ class ModelTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->model =& new User();
|
||||
$result = $this->model->_tableInfo->value;
|
||||
$result = $this->model->loadInfo();
|
||||
$result = $result->value;
|
||||
|
||||
$db =& ConnectionManager::getDataSource('test_suite');
|
||||
if (isset($db->columns['primary_key']['length'])) {
|
||||
|
@ -3012,4 +3014,5 @@ class ValidationTest extends CakeTestModel {
|
|||
return new Set();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -169,13 +169,13 @@ class CakeTestCase extends UnitTestCase {
|
|||
|
||||
foreach ($this->_queries['create'] as $query) {
|
||||
if (isset($query) && $query !== false) {
|
||||
$this->db->_execute($query);
|
||||
$this->db->execute($query);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->_queries['insert'] as $query) {
|
||||
if (isset($query) && $query !== false) {
|
||||
$this->db->_execute($query);
|
||||
$this->db->execute($query);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ class CakeTestCase extends UnitTestCase {
|
|||
if (isset($this->db) && isset($this->_queries) && !empty($this->_queries) && !empty($this->_queries['drop'])) {
|
||||
foreach ($this->_queries['drop'] as $query) {
|
||||
if (isset($query) && $query !== false) {
|
||||
$this->db->_execute($query);
|
||||
$this->db->execute($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ class CakeTestCase extends UnitTestCase {
|
|||
if (isset($inserts) && !empty($inserts)) {
|
||||
foreach ($inserts as $query) {
|
||||
if (isset($query) && $query !== false) {
|
||||
$this->db->_execute($query);
|
||||
$this->db->execute($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ class CakeTestCase extends UnitTestCase {
|
|||
foreach ($this->_fixtures as $fixture) {
|
||||
$query = $fixture->create();
|
||||
if (isset($query) && $query !== false) {
|
||||
$this->db->_execute($query);
|
||||
$this->db->execute($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ class CakeTestCase extends UnitTestCase {
|
|||
foreach (array_reverse($this->_fixtures) as $fixture) {
|
||||
$query = $fixture->drop();
|
||||
if (isset($query) && $query !== false) {
|
||||
$this->db->_execute($query);
|
||||
$this->db->execute($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,10 +366,7 @@ class CakeTestCase extends UnitTestCase {
|
|||
function after($method) {
|
||||
if (isset($this->_fixtures) && isset($this->db) && !in_array(low($method), array('start', 'end'))) {
|
||||
foreach ($this->_fixtures as $fixture) {
|
||||
$query = $fixture->truncate();
|
||||
if (isset($query) && $query !== false) {
|
||||
$this->db->_execute($query);
|
||||
}
|
||||
$this->db->truncate($fixture->table);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue