mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
Adding headers to files.
Formating doc comments git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4668 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
3a4a49ef03
commit
44f4d8d6f8
10 changed files with 452 additions and 147 deletions
34
cake/tests/fixtures/article_fixture.php
vendored
34
cake/tests/fixtures/article_fixture.php
vendored
|
@ -1,5 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
*/
|
||||||
class ArticleFixture extends CakeTestFixture {
|
class ArticleFixture extends CakeTestFixture {
|
||||||
var $name = 'Article';
|
var $name = 'Article';
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
|
|
34
cake/tests/fixtures/articles_tag_fixture.php
vendored
34
cake/tests/fixtures/articles_tag_fixture.php
vendored
|
@ -1,5 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
*/
|
||||||
class ArticlesTagFixture extends CakeTestFixture {
|
class ArticlesTagFixture extends CakeTestFixture {
|
||||||
var $name = 'ArticlesTag';
|
var $name = 'ArticlesTag';
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
|
|
34
cake/tests/fixtures/attachment_fixture.php
vendored
34
cake/tests/fixtures/attachment_fixture.php
vendored
|
@ -1,5 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
*/
|
||||||
class AttachmentFixture extends CakeTestFixture {
|
class AttachmentFixture extends CakeTestFixture {
|
||||||
var $name = 'Attachment';
|
var $name = 'Attachment';
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
|
|
34
cake/tests/fixtures/category_fixture.php
vendored
34
cake/tests/fixtures/category_fixture.php
vendored
|
@ -1,5 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
*/
|
||||||
class CategoryFixture extends CakeTestFixture {
|
class CategoryFixture extends CakeTestFixture {
|
||||||
var $name = 'Category';
|
var $name = 'Category';
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
|
|
34
cake/tests/fixtures/comment_fixture.php
vendored
34
cake/tests/fixtures/comment_fixture.php
vendored
|
@ -1,5 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
*/
|
||||||
class CommentFixture extends CakeTestFixture {
|
class CommentFixture extends CakeTestFixture {
|
||||||
var $name = 'Comment';
|
var $name = 'Comment';
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
|
|
34
cake/tests/fixtures/tag_fixture.php
vendored
34
cake/tests/fixtures/tag_fixture.php
vendored
|
@ -1,5 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
*/
|
||||||
class TagFixture extends CakeTestFixture {
|
class TagFixture extends CakeTestFixture {
|
||||||
var $name = 'Tag';
|
var $name = 'Tag';
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
|
|
34
cake/tests/fixtures/user_fixture.php
vendored
34
cake/tests/fixtures/user_fixture.php
vendored
|
@ -1,5 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake.tests
|
||||||
|
* @subpackage cake.tests.fixtures
|
||||||
|
*/
|
||||||
class UserFixture extends CakeTestFixture {
|
class UserFixture extends CakeTestFixture {
|
||||||
var $name = 'User';
|
var $name = 'User';
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
|
|
|
@ -1,32 +1,62 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.libs
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_model.php';
|
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_model.php';
|
||||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_fixture.php';
|
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_fixture.php';
|
||||||
|
|
||||||
vendor('simpletest'.DS.'unit_tester');
|
vendor('simpletest'.DS.'unit_tester');
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
class CakeTestCase extends UnitTestCase {
|
class CakeTestCase extends UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* Announces the start of a test.
|
* Announces the start of a test.
|
||||||
*
|
*
|
||||||
* @param string $method Test method just started.
|
* @param string $method Test method just started.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function before($method) {
|
function before($method) {
|
||||||
parent::before($method);
|
parent::before($method);
|
||||||
|
|
||||||
if (isset($this->fixtures) && (!is_array($this->fixtures) || empty($this->fixtures))) {
|
if (isset($this->fixtures) && (!is_array($this->fixtures) || empty($this->fixtures))) {
|
||||||
unset($this->fixtures);
|
unset($this->fixtures);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up DB connection
|
// Set up DB connection
|
||||||
if (isset($this->fixtures) && low($method) == 'start') {
|
if (isset($this->fixtures) && low($method) == 'start') {
|
||||||
// Try for test DB
|
// Try for test DB
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
@$db =& ConnectionManager::getDataSource('test');
|
@$db =& ConnectionManager::getDataSource('test');
|
||||||
set_error_handler('simpleTestErrorHandler');
|
set_error_handler('simpleTestErrorHandler');
|
||||||
|
|
||||||
// Try for default DB
|
// Try for default DB
|
||||||
if (!$db->isConnected()) {
|
if (!$db->isConnected()) {
|
||||||
$db =& ConnectionManager::getDataSource('default');
|
$db =& ConnectionManager::getDataSource('default');
|
||||||
|
@ -35,22 +65,22 @@ class CakeTestCase extends UnitTestCase {
|
||||||
// Add test prefix
|
// Add test prefix
|
||||||
$config = $db->config;
|
$config = $db->config;
|
||||||
$config['prefix'] .= 'test_suite_';
|
$config['prefix'] .= 'test_suite_';
|
||||||
|
|
||||||
// Set up db connection
|
// Set up db connection
|
||||||
ConnectionManager::create('test_suite', $config);
|
ConnectionManager::create('test_suite', $config);
|
||||||
|
|
||||||
// Get db connection
|
// Get db connection
|
||||||
$this->db =& ConnectionManager::getDataSource('test_suite');
|
$this->db =& ConnectionManager::getDataSource('test_suite');
|
||||||
$this->db->fullDebug = false;
|
$this->db->fullDebug = false;
|
||||||
|
|
||||||
$this->_loadFixtures();
|
$this->_loadFixtures();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create records
|
// Create records
|
||||||
if (isset($this->_fixtures) && isset($this->db) && !in_array(low($method), array('start', 'end'))) {
|
if (isset($this->_fixtures) && isset($this->db) && !in_array(low($method), array('start', 'end'))) {
|
||||||
foreach($this->_fixtures as $fixture) {
|
foreach($this->_fixtures as $fixture) {
|
||||||
$inserts = $fixture->insert();
|
$inserts = $fixture->insert();
|
||||||
|
|
||||||
if (isset($inserts) && !empty($inserts)) {
|
if (isset($inserts) && !empty($inserts)) {
|
||||||
foreach($inserts as $query) {
|
foreach($inserts as $query) {
|
||||||
if (isset($query) && $query !== false) {
|
if (isset($query) && $query !== false) {
|
||||||
|
@ -61,99 +91,95 @@ class CakeTestCase extends UnitTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Runs as first test to create tables.
|
||||||
* Runs as first test to create tables.
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function start() {
|
function start() {
|
||||||
if (isset($this->_fixtures) && isset($this->db)) {
|
if (isset($this->_fixtures) && isset($this->db)) {
|
||||||
foreach($this->_fixtures as $fixture) {
|
foreach($this->_fixtures as $fixture) {
|
||||||
$query = $fixture->create();
|
$query = $fixture->create();
|
||||||
|
|
||||||
if (isset($query) && $query !== false) {
|
if (isset($query) && $query !== false) {
|
||||||
$this->db->_execute($query);
|
$this->db->_execute($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Runs as last test to drop tables.
|
||||||
* Runs as last test to drop tables.
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function end() {
|
function end() {
|
||||||
if (isset($this->_fixtures) && isset($this->db)) {
|
if (isset($this->_fixtures) && isset($this->db)) {
|
||||||
foreach(array_reverse($this->_fixtures) as $fixture) {
|
foreach(array_reverse($this->_fixtures) as $fixture) {
|
||||||
$query = $fixture->drop();
|
$query = $fixture->drop();
|
||||||
|
|
||||||
if (isset($query) && $query !== false) {
|
if (isset($query) && $query !== false) {
|
||||||
$this->db->_execute($query);
|
$this->db->_execute($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Announces the end of a test.
|
* Announces the end of a test.
|
||||||
*
|
*
|
||||||
* @param string $method Test method just finished.
|
* @param string $method Test method just finished.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function after($method) {
|
function after($method) {
|
||||||
if (isset($this->_fixtures) && isset($this->db) && !in_array(low($method), array('start', 'end'))) {
|
if (isset($this->_fixtures) && isset($this->db) && !in_array(low($method), array('start', 'end'))) {
|
||||||
foreach($this->_fixtures as $fixture) {
|
foreach($this->_fixtures as $fixture) {
|
||||||
$query = $fixture->truncate();
|
$query = $fixture->truncate();
|
||||||
|
|
||||||
if (isset($query) && $query !== false) {
|
if (isset($query) && $query !== false) {
|
||||||
$this->db->_execute($query);
|
$this->db->_execute($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::after($method);
|
parent::after($method);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Gets a list of test names. Normally that will be all internal methods that start with the
|
||||||
* Gets a list of test names. Normally that will be all internal methods that start with the
|
* name "test". This method should be overridden if you want a different rule.
|
||||||
* name "test". This method should be overridden if you want a different rule.
|
*
|
||||||
*
|
* @return array List of test names.
|
||||||
* @return array List of test names.
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function getTests() {
|
function getTests() {
|
||||||
$methods = parent::getTests();
|
$methods = parent::getTests();
|
||||||
|
|
||||||
if (isset($this->fixtures)) {
|
if (isset($this->fixtures)) {
|
||||||
$methods = am(am(array('start'), $methods), array('end'));
|
$methods = am(am(array('start'), $methods), array('end'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $methods;
|
return $methods;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Load fixtures specified in var $fixtures.
|
||||||
* Load fixtures specified in var $fixtures.
|
*
|
||||||
*
|
* @access private
|
||||||
* @access private
|
*/
|
||||||
*/
|
|
||||||
function _loadFixtures() {
|
function _loadFixtures() {
|
||||||
if (!isset($this->fixtures) || empty($this->fixtures)) {
|
if (!isset($this->fixtures) || empty($this->fixtures)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($this->fixtures)) {
|
if (!is_array($this->fixtures)) {
|
||||||
$this->fixtures = array( $this->fixtures );
|
$this->fixtures = array( $this->fixtures );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_fixtures = array();
|
$this->_fixtures = array();
|
||||||
|
|
||||||
foreach($this->fixtures as $index => $fixture) {
|
foreach($this->fixtures as $index => $fixture) {
|
||||||
$fixtureFile = null;
|
$fixtureFile = null;
|
||||||
|
|
||||||
if (strpos($fixture, 'core.') === 0) {
|
if (strpos($fixture, 'core.') === 0) {
|
||||||
$fixture = substr($fixture, strlen('core.'));
|
$fixture = substr($fixture, strlen('core.'));
|
||||||
$fixturePaths = array(
|
$fixturePaths = array(
|
||||||
|
@ -170,27 +196,26 @@ class CakeTestCase extends UnitTestCase {
|
||||||
CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'tests' . DS . 'fixtures'
|
CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'tests' . DS . 'fixtures'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($fixturePaths as $path) {
|
foreach($fixturePaths as $path) {
|
||||||
if (is_readable($path . DS . $fixture . '_fixture.php')) {
|
if (is_readable($path . DS . $fixture . '_fixture.php')) {
|
||||||
$fixtureFile = $path . DS . $fixture . '_fixture.php';
|
$fixtureFile = $path . DS . $fixture . '_fixture.php';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($fixtureFile)) {
|
if (isset($fixtureFile)) {
|
||||||
require_once($fixtureFile);
|
require_once($fixtureFile);
|
||||||
|
|
||||||
$fixtureClass = Inflector::camelize($fixture) . 'Fixture';
|
$fixtureClass = Inflector::camelize($fixture) . 'Fixture';
|
||||||
|
|
||||||
$this->_fixtures[$this->fixtures[$index]] =& new $fixtureClass($this->db);
|
$this->_fixtures[$this->fixtures[$index]] =& new $fixtureClass($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->_fixtures)) {
|
if (empty($this->_fixtures)) {
|
||||||
unset($this->_fixtures);
|
unset($this->_fixtures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1,154 +1,180 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.libs
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
class CakeTestFixture extends Object {
|
class CakeTestFixture extends Object {
|
||||||
var $db = null;
|
var $db = null;
|
||||||
|
/**
|
||||||
/**
|
* Instantiate the fixture.
|
||||||
* Instantiate the fixture.
|
*
|
||||||
*
|
* @param object Cake's DBO driver (e.g: DboMysql).
|
||||||
* @param object Cake's DBO driver (e.g: DboMysql).
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function __construct(&$db) {
|
function __construct(&$db) {
|
||||||
$this->db =& $db;
|
$this->db =& $db;
|
||||||
|
|
||||||
if (!isset($this->table)) {
|
if (!isset($this->table)) {
|
||||||
$this->table = Inflector::underscore(Inflector::pluralize($this->name));
|
$this->table = Inflector::underscore(Inflector::pluralize($this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->primaryKey) && isset($this->fields['id'])) {
|
if (!isset($this->primaryKey) && isset($this->fields['id'])) {
|
||||||
$this->primaryKey = 'id';
|
$this->primaryKey = 'id';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->primaryKey) && !is_array($this->primaryKey)) {
|
if (isset($this->primaryKey) && !is_array($this->primaryKey)) {
|
||||||
$this->primaryKey = array( $this->primaryKey );
|
$this->primaryKey = array( $this->primaryKey );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Run before all tests execute, should return SQL statement to create table for this fixture.
|
||||||
* Run before all tests execute, should return SQL statement to create table for this fixture.
|
*
|
||||||
*
|
* @return string SQL CREATE TABLE statement, false if not applicable.
|
||||||
* @return string SQL CREATE TABLE statement, false if not applicable.
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function create() {
|
function create() {
|
||||||
if (!isset($this->_create)) {
|
if (!isset($this->_create)) {
|
||||||
if (!isset($this->fields) || empty($this->fields)) {
|
if (!isset($this->fields) || empty($this->fields)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$create = 'CREATE TABLE ' . $this->db->name($this->db->config['prefix'] . $this->table) . ' (' . "\n";
|
$create = 'CREATE TABLE ' . $this->db->name($this->db->config['prefix'] . $this->table) . ' (' . "\n";
|
||||||
|
|
||||||
foreach($this->fields as $field => $attributes) {
|
foreach($this->fields as $field => $attributes) {
|
||||||
if (!is_array($attributes)) {
|
if (!is_array($attributes)) {
|
||||||
$attributes = array('type' => $attributes);
|
$attributes = array('type' => $attributes);
|
||||||
} else if (isset($attributes['key']) && low($attributes['key']) == 'primary' && !isset($this->primaryKey)) {
|
} else if (isset($attributes['key']) && low($attributes['key']) == 'primary' && !isset($this->primaryKey)) {
|
||||||
$this->primaryKey = array ( $field );
|
$this->primaryKey = array ( $field );
|
||||||
}
|
}
|
||||||
|
|
||||||
$column = array($field, $attributes['type']);
|
$column = array($field, $attributes['type']);
|
||||||
unset($attributes['type']);
|
unset($attributes['type']);
|
||||||
|
|
||||||
if (!empty($attributes)) {
|
if (!empty($attributes)) {
|
||||||
$column = array_merge($column, $attributes);
|
$column = array_merge($column, $attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
$create .= $this->db->generateColumnSchema($column) . ',' . "\n";
|
$create .= $this->db->generateColumnSchema($column) . ',' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->primaryKey)) {
|
if (isset($this->primaryKey)) {
|
||||||
foreach($this->primaryKey as $index => $field) {
|
foreach($this->primaryKey as $index => $field) {
|
||||||
$this->primaryKey[$index] = $this->db->name($field);
|
$this->primaryKey[$index] = $this->db->name($field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->primaryKey)) {
|
if (!isset($this->primaryKey)) {
|
||||||
$create = substr($create, 0, -1);
|
$create = substr($create, 0, -1);
|
||||||
} else {
|
} else {
|
||||||
$create .= 'PRIMARY KEY(' . implode(', ', $this->primaryKey) . ')' . "\n";
|
$create .= 'PRIMARY KEY(' . implode(', ', $this->primaryKey) . ')' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$create .= ')';
|
$create .= ')';
|
||||||
|
|
||||||
$this->_create = $create;
|
$this->_create = $create;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_create;
|
return $this->_create;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Run after all tests executed, should return SQL statement to drop table for this fixture.
|
||||||
* Run after all tests executed, should return SQL statement to drop table for this fixture.
|
*
|
||||||
*
|
* @return string SQL DROP TABLE statement, false if not applicable.
|
||||||
* @return string SQL DROP TABLE statement, false if not applicable.
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function drop() {
|
function drop() {
|
||||||
if (!isset($this->_drop)) {
|
if (!isset($this->_drop)) {
|
||||||
$this->_drop = 'DROP TABLE ' . $this->db->name($this->db->config['prefix'] . $this->table);
|
$this->_drop = 'DROP TABLE ' . $this->db->name($this->db->config['prefix'] . $this->table);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_drop;
|
return $this->_drop;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Run after each tests is executed, should return SQL statement to empty of records the table for this fixture.
|
||||||
* Run after each tests is executed, should return SQL statement to empty of records the table for this fixture.
|
*
|
||||||
*
|
* @return string SQL TRUNCATE TABLE statement, false if not applicable.
|
||||||
* @return string SQL TRUNCATE TABLE statement, false if not applicable.
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function truncate() {
|
function truncate() {
|
||||||
if (!isset($this->_truncate)) {
|
if (!isset($this->_truncate)) {
|
||||||
$this->_truncate = 'TRUNCATE ' . $this->db->name($this->db->config['prefix'] . $this->table);
|
$this->_truncate = 'TRUNCATE ' . $this->db->name($this->db->config['prefix'] . $this->table);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_truncate;
|
return $this->_truncate;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* Run before each tests is executed, should return a set of SQL statements to insert records for the table of this fixture.
|
||||||
* Run before each tests is executed, should return a set of SQL statements to insert records for the table of this fixture.
|
*
|
||||||
*
|
* @return array SQL INSERT statements, empty array if not applicable.
|
||||||
* @return array SQL INSERT statements, empty array if not applicable.
|
*
|
||||||
*
|
* @access public
|
||||||
* @access public
|
*/
|
||||||
*/
|
|
||||||
function insert() {
|
function insert() {
|
||||||
if (!isset($this->_insert)) {
|
if (!isset($this->_insert)) {
|
||||||
$inserts = array();
|
$inserts = array();
|
||||||
|
|
||||||
if (isset($this->records) && !empty($this->records)) {
|
if (isset($this->records) && !empty($this->records)) {
|
||||||
foreach($this->records as $record) {
|
foreach($this->records as $record) {
|
||||||
$fields = array_keys($record);
|
$fields = array_keys($record);
|
||||||
$values = array_values($record);
|
$values = array_values($record);
|
||||||
|
|
||||||
$insert = 'INSERT INTO ' . $this->db->name($this->db->config['prefix'] . $this->table) . '(';
|
$insert = 'INSERT INTO ' . $this->db->name($this->db->config['prefix'] . $this->table) . '(';
|
||||||
|
|
||||||
foreach($fields as $field) {
|
foreach($fields as $field) {
|
||||||
$insert .= $this->db->name($field) . ',';
|
$insert .= $this->db->name($field) . ',';
|
||||||
}
|
}
|
||||||
$insert = substr($insert, 0, -1);
|
$insert = substr($insert, 0, -1);
|
||||||
|
|
||||||
$insert .= ') VALUES (';
|
$insert .= ') VALUES (';
|
||||||
|
|
||||||
foreach($values as $values) {
|
foreach($values as $values) {
|
||||||
$insert .= $this->db->value($values) . ',';
|
$insert .= $this->db->value($values) . ',';
|
||||||
}
|
}
|
||||||
$insert = substr($insert, 0, -1);
|
$insert = substr($insert, 0, -1);
|
||||||
|
|
||||||
$insert .= ')';
|
$insert .= ')';
|
||||||
|
|
||||||
$inserts[] = $insert;
|
$inserts[] = $insert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_insert = $inserts;
|
$this->_insert = $inserts;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_insert;
|
return $this->_insert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1,9 +1,39 @@
|
||||||
<?php
|
<?php
|
||||||
|
/* SVN FILE: $Id$ */
|
||||||
|
/**
|
||||||
|
* Short description for file.
|
||||||
|
*
|
||||||
|
* Long description for file
|
||||||
|
*
|
||||||
|
* PHP versions 4 and 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* 1785 E. Sahara Avenue, Suite 490-204
|
||||||
|
* Las Vegas, Nevada 89104
|
||||||
|
*
|
||||||
|
* Licensed under The Open Group Test Suite License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @filesource
|
||||||
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||||
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.libs
|
||||||
|
* @since CakePHP(tm) v 1.2.0.4667
|
||||||
|
* @version $Revision$
|
||||||
|
* @modifiedby $LastChangedBy$
|
||||||
|
* @lastmodified $Date$
|
||||||
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
|
*/
|
||||||
require_once LIBS.'model'.DS.'model.php';
|
require_once LIBS.'model'.DS.'model.php';
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
class CakeTestModel extends Model {
|
class CakeTestModel extends Model {
|
||||||
var $useDbConfig = 'test_suite';
|
var $useDbConfig = 'test_suite';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue