mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Pattern to use skipIf in tests.
This commit is contained in:
parent
ed96936ea7
commit
aacb921695
27 changed files with 92 additions and 156 deletions
|
@ -85,7 +85,7 @@ class BasicsTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testEnv() {
|
||||
$this->skipIf(!function_exists('ini_get') || ini_get('safe_mode') === '1', '%s safe mode is on');
|
||||
$this->skipIf(!function_exists('ini_get') || ini_get('safe_mode') === '1', 'Safe mode is on.');
|
||||
|
||||
$__SERVER = $_SERVER;
|
||||
$__ENV = $_ENV;
|
||||
|
@ -258,9 +258,7 @@ class BasicsTest extends CakeTestCase {
|
|||
*/
|
||||
public function testCache() {
|
||||
$_cacheDisable = Configure::read('Cache.disable');
|
||||
if ($this->skipIf($_cacheDisable, 'Cache is disabled, skipping cache() tests. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($_cacheDisable, 'Cache is disabled, skipping cache() tests.');
|
||||
|
||||
Configure::write('Cache.disable', true);
|
||||
$result = cache('basics_test', 'simple cache write');
|
||||
|
@ -293,9 +291,7 @@ class BasicsTest extends CakeTestCase {
|
|||
*/
|
||||
public function testClearCache() {
|
||||
$cacheOff = Configure::read('Cache.disable');
|
||||
if ($this->skipIf($cacheOff, 'Cache is disabled, skipping clearCache() tests. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($cacheOff, 'Cache is disabled, skipping clearCache() tests.');
|
||||
|
||||
cache('views' . DS . 'basics_test.cache', 'simple cache write');
|
||||
$this->assertTrue(file_exists(CACHE . 'views' . DS . 'basics_test.cache'));
|
||||
|
@ -725,7 +721,7 @@ class BasicsTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testStripslashesDeep() {
|
||||
$this->skipIf(ini_get('magic_quotes_sybase') === '1', '%s magic_quotes_sybase is on');
|
||||
$this->skipIf(ini_get('magic_quotes_sybase') === '1', 'magic_quotes_sybase is on.');
|
||||
|
||||
$this->assertEqual(stripslashes_deep("tes\'t"), "tes't");
|
||||
$this->assertEqual(stripslashes_deep('tes\\' . chr(0) .'t'), 'tes' . chr(0) .'t');
|
||||
|
|
|
@ -33,7 +33,8 @@ class ApcEngineTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
$this->skipIf(!function_exists('apc_store'), '%s Apc is not installed or configured properly');
|
||||
$this->skipIf(!function_exists('apc_store'), 'Apc is not installed or configured properly.');
|
||||
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
Configure::write('Cache.disable', false);
|
||||
Cache::config('apc', array('engine' => 'Apc', 'prefix' => 'cake_'));
|
||||
|
@ -132,9 +133,8 @@ class ApcEngineTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testDecrement() {
|
||||
if ($this->skipIf(!function_exists('apc_dec'), 'No apc_dec() function, cannot test decrement() %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!function_exists('apc_dec'), 'No apc_dec() function, cannot test decrement().');
|
||||
|
||||
$result = Cache::write('test_decrement', 5, 'apc');
|
||||
$this->assertTrue($result);
|
||||
|
||||
|
@ -159,9 +159,8 @@ class ApcEngineTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testIncrement() {
|
||||
if ($this->skipIf(!function_exists('apc_inc'), 'No apc_inc() function, cannot test increment() %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!function_exists('apc_inc'), 'No apc_inc() function, cannot test increment().');
|
||||
|
||||
$result = Cache::write('test_increment', 5, 'apc');
|
||||
$this->assertTrue($result);
|
||||
|
||||
|
|
|
@ -332,9 +332,8 @@ class FileEngineTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testErrorWhenPathDoesNotExist() {
|
||||
if ($this->skipIf(is_dir(TMP . 'tests' . DS . 'file_failure'), 'Cannot run test directory exists. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(is_dir(TMP . 'tests' . DS . 'file_failure'), 'Cannot run test directory exists.');
|
||||
|
||||
$this->expectError();
|
||||
Cache::config('failure', array(
|
||||
'engine' => 'File',
|
||||
|
|
|
@ -50,7 +50,8 @@ class MemcacheEngineTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
$this->skipIf(!class_exists('Memcache'), '%s Memcache is not installed or configured properly');
|
||||
$this->skipIf(!class_exists('Memcache'), 'Memcache is not installed or configured properly.');
|
||||
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
Configure::write('Cache.disable', false);
|
||||
Cache::config('memcache', array(
|
||||
|
@ -111,9 +112,8 @@ class MemcacheEngineTest extends CakeTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->skipIf(!$available, '%s Need memcache servers at ' . implode(', ', $servers) . ' to run this test')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!$available, 'Need memcache servers at ' . implode(', ', $servers) . ' to run this test.');
|
||||
|
||||
$Memcache = new MemcacheEngine();
|
||||
$Memcache->init(array('engine' => 'Memcache', 'servers' => $servers));
|
||||
|
||||
|
|
|
@ -77,9 +77,8 @@ class BakeShellTest extends CakeTestCase {
|
|||
public function testAllWithModelName() {
|
||||
App::uses('User', 'Model');
|
||||
$userExists = class_exists('User');
|
||||
if ($this->skipIf($userExists, 'User class exists, cannot test `bake all [param]`. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($userExists, 'User class exists, cannot test `bake all [param]`.');
|
||||
|
||||
$this->Shell->Model = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
|
||||
$this->Shell->Controller = $this->getMock('ControllerTask', array(), array(&$this->Dispatcher));
|
||||
$this->Shell->View = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
|
||||
|
|
|
@ -507,7 +507,7 @@ class ShellTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreateFileNonInteractive() {
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Not supported on Windows');
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'Not supported on Windows.');
|
||||
|
||||
$path = TMP . 'shell_test';
|
||||
$file = $path . DS . 'file1.php';
|
||||
|
@ -537,7 +537,7 @@ class ShellTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreateFileInteractive() {
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Not supported on Windows');
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'Not supported on Windows.');
|
||||
|
||||
$path = TMP . 'shell_test';
|
||||
$file = $path . DS . 'file1.php';
|
||||
|
@ -583,7 +583,7 @@ class ShellTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreateFileWindowsNonInteractive() {
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '/', 'testCreateFileWindows supported on Windows only');
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '/', 'testCreateFileWindowsNonInteractive supported on Windows only.');
|
||||
|
||||
$path = TMP . 'shell_test';
|
||||
$file = $path . DS . 'file1.php';
|
||||
|
@ -614,7 +614,7 @@ class ShellTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreateFileWindowsInteractive() {
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '/', 'testCreateFileWindowsInteractive supported on Windows only');
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '/', 'testCreateFileWindowsInteractive supported on Windows only.');
|
||||
|
||||
$path = TMP . 'shell_test';
|
||||
$file = $path . DS . 'file1.php';
|
||||
|
|
|
@ -329,11 +329,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testBakeActionsUsingSessions() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s');
|
||||
if ($skip) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Testing bakeActions requires Article, Comment & Tag Model to be undefined.');
|
||||
|
||||
$result = $this->Task->bakeActions('BakeArticles', null, true);
|
||||
|
||||
$this->assertContains('function index() {', $result);
|
||||
|
@ -371,11 +368,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testBakeActionsWithNoSessions() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s');
|
||||
if ($skip) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Testing bakeActions requires Article, Tag, Comment Models to be undefined.');
|
||||
|
||||
$result = $this->Task->bakeActions('BakeArticles', null, false);
|
||||
|
||||
$this->assertContains('function index() {', $result);
|
||||
|
|
|
@ -374,10 +374,8 @@ class TestTaskTest extends CakeTestCase {
|
|||
*/
|
||||
public function testGetClassName() {
|
||||
$objects = App::objects('model');
|
||||
$skip = $this->skipIf(empty($objects), 'No models in app, this test will fail.');
|
||||
if ($skip) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(empty($objects), 'No models in app.');
|
||||
|
||||
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('MyCustomClass'));
|
||||
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(1));
|
||||
|
||||
|
|
|
@ -392,8 +392,8 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testGetShell() {
|
||||
$this->skipIf(class_exists('SampleShell'), '%s SampleShell Class already loaded');
|
||||
$this->skipIf(class_exists('ExampleShell'), '%s ExampleShell Class already loaded');
|
||||
$this->skipIf(class_exists('SampleShell'), 'SampleShell Class already loaded.');
|
||||
$this->skipIf(class_exists('ExampleShell'), 'ExampleShell Class already loaded.');
|
||||
|
||||
$Dispatcher = new TestShellDispatcher();
|
||||
|
||||
|
|
|
@ -602,10 +602,8 @@ HTMLBLOC;
|
|||
* @return void
|
||||
*/
|
||||
public function test_encodeSettingInternalCharset() {
|
||||
$skip = !function_exists('mb_internal_encoding');
|
||||
if ($this->skipIf($skip, 'Missing mb_* functions, cannot run test.')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!function_exists('mb_internal_encoding'), 'Missing mb_* functions, cannot run test.');
|
||||
|
||||
$restore = mb_internal_encoding();
|
||||
mb_internal_encoding('ISO-8859-1');
|
||||
|
||||
|
|
|
@ -186,9 +186,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testHandleException() {
|
||||
if ($this->skipIf(file_exists(APP . 'app_error.php'), 'App error exists cannot run.')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(file_exists(APP . 'app_error.php'), 'App error exists cannot run.');
|
||||
|
||||
$error = new NotFoundException('Kaboom!');
|
||||
ob_start();
|
||||
|
@ -203,9 +201,8 @@ class ErrorHandlerTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testHandleExceptionLog() {
|
||||
if ($this->skipIf(file_exists(APP . 'app_error.php'), 'App error exists cannot run.')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(file_exists(APP . 'app_error.php'), 'App error exists cannot run.');
|
||||
|
||||
if (file_exists(LOGS . 'error.log')) {
|
||||
unlink(LOGS . 'error.log');
|
||||
}
|
||||
|
|
|
@ -4794,10 +4794,8 @@ class MultibyteTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testUsingMbStrrpos() {
|
||||
$skip = extension_loaded('mbstring') && version_compare(PHP_VERSION, '5.2.0', '<');
|
||||
if ($this->skipIf($skip, '%s PHP version does not support $offset parameter in mb_strrpos().')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(extension_loaded('mbstring') && version_compare(PHP_VERSION, '5.2.0', '<'), 'PHP version does not support $offset parameter in mb_strrpos().');
|
||||
|
||||
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
$find = 'F';
|
||||
$result = mb_strrpos($string, $find);
|
||||
|
|
|
@ -3500,15 +3500,11 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
public function testAutoFieldsWithMultipleDatabases() {
|
||||
$config = new DATABASE_CONFIG();
|
||||
|
||||
$skip = $this->skipIf(
|
||||
$this->skipIf(
|
||||
!isset($config->test) || !isset($config->test2),
|
||||
'%s Primary and secondary test databases not configured, skipping cross-database '
|
||||
.'join tests.'
|
||||
.' To run these tests, you must define $test and $test2 in your database configuration.'
|
||||
'Primary and secondary test databases not configured, skipping cross-database join tests.'
|
||||
. ' To run these tests, you must define $test and $test2 in your database configuration.'
|
||||
);
|
||||
if ($skip) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db = ConnectionManager::getDataSource('test2');
|
||||
$this->fixtureManager->loadSingle('User', $db);
|
||||
|
|
|
@ -610,7 +610,8 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
*/
|
||||
public function testSchemaReadWithOddTablePrefix() {
|
||||
$config = ConnectionManager::getDataSource('test')->config;
|
||||
$this->skipIf(!empty($config['prefix']), 'This test can not be executed with datasource prefix set');
|
||||
$this->skipIf(!empty($config['prefix']), 'This test can not be executed with datasource prefix set.');
|
||||
|
||||
$SchemaPost = ClassRegistry::init('SchemaPost');
|
||||
$SchemaPost->tablePrefix = 'po';
|
||||
$SchemaPost->useTable = 'sts';
|
||||
|
@ -630,7 +631,7 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
*/
|
||||
public function testSchemaReadWithTablePrefix() {
|
||||
$config = ConnectionManager::getDataSource('test')->config;
|
||||
$this->skipIf(!empty($config['prefix']), 'This test can not be executed with datasource prefix set');
|
||||
$this->skipIf(!empty($config['prefix']), 'This test can not be executed with datasource prefix set.');
|
||||
|
||||
$model = new SchemaPrefixAuthUser();
|
||||
|
||||
|
@ -695,15 +696,11 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
*/
|
||||
public function testSchemaReadWithCrossDatabase() {
|
||||
$config = new DATABASE_CONFIG();
|
||||
$skip = $this->skipIf(
|
||||
$this->skipIf(
|
||||
!isset($config->test) || !isset($config->test2),
|
||||
'%s Primary and secondary test databases not configured, skipping cross-database '
|
||||
.'join tests.'
|
||||
.' To run these tests, you must define $test and $test2 in your database configuration.'
|
||||
'Primary and secondary test databases not configured, skipping cross-database join tests.'
|
||||
. ' To run these tests, you must define $test and $test2 in your database configuration.'
|
||||
);
|
||||
if ($skip) {
|
||||
return;
|
||||
}
|
||||
|
||||
$db2 = ConnectionManager::getDataSource('test2');
|
||||
$fixture = new SchemaCrossDatabaseFixture();
|
||||
|
|
|
@ -820,6 +820,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
*/
|
||||
public function testStatements() {
|
||||
$this->skipIf(!$this->testDb instanceof DboMysql);
|
||||
|
||||
$this->loadFixtures('Article', 'User', 'Comment', 'Tag', 'Attachment', 'ArticlesTag');
|
||||
$Article = new Article();
|
||||
|
||||
|
|
|
@ -82,9 +82,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
$isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle || $this->db instanceof Sqlserver;
|
||||
$message = 'Postgres, Oracle, SQLite and SQL Server have strict GROUP BY and are incompatible with this test.';
|
||||
|
||||
if ($this->skipIf($isStrictGroupBy, $message )) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($isStrictGroupBy, $message);
|
||||
|
||||
$this->loadFixtures('Project', 'Product', 'Thread', 'Message', 'Bid');
|
||||
$Thread = new Thread();
|
||||
|
@ -390,9 +388,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
public function testRecursiveUnbind() {
|
||||
if ($this->skipIf($this->db instanceof Sqlserver, 'The test of testRecursiveUnbind test is not compatible with SQL Server, because it check for time columns.')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($this->db instanceof Sqlserver, 'The test of testRecursiveUnbind test is not compatible with SQL Server, because it check for time columns.');
|
||||
|
||||
$this->loadFixtures('Apple', 'Sample');
|
||||
$TestModel = new Apple();
|
||||
|
@ -3648,9 +3644,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
public function testFindCombinedRelations() {
|
||||
if ($this->skipIf($this->db instanceof Sqlserver, 'The test of testRecursiveUnbind test is not compatible with SQL Server, because it check for time columns.')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($this->db instanceof Sqlserver, 'The test of testRecursiveUnbind test is not compatible with SQL Server, because it check for time columns.');
|
||||
|
||||
$this->loadFixtures('Apple', 'Sample');
|
||||
$TestModel = new Apple();
|
||||
|
@ -4020,9 +4014,8 @@ class ModelReadTest extends BaseModelTest {
|
|||
$result = $TestModel->find('all', compact('conditions', 'recursive', 'order'));
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
if ($this->skipIf($this->db instanceof Postgres, 'The rest of testFindAllWithConditionsHavingMixedDataTypes test is not compatible with Postgres')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($this->db instanceof Postgres, 'The rest of testFindAllWithConditionsHavingMixedDataTypes test is not compatible with Postgres.');
|
||||
|
||||
$conditions = array('id' => array('1', 2, '3.0'));
|
||||
$order = 'Article.id ASC';
|
||||
$result = $TestModel->find('all', compact('recursive', 'conditions', 'order'));
|
||||
|
@ -6622,7 +6615,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
public function testFindCountDistinct() {
|
||||
$this->skipIf($this->db instanceof Sqlite, 'SELECT COUNT(DISTINCT field) is not compatible with SQLite');
|
||||
$this->skipIf($this->db instanceof Sqlite, 'SELECT COUNT(DISTINCT field) is not compatible with SQLite.');
|
||||
$this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.');
|
||||
|
||||
$this->loadFixtures('Project');
|
||||
|
@ -6642,9 +6635,8 @@ class ModelReadTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
public function testFindCountWithDbExpressions() {
|
||||
if ($this->skipIf($this->db instanceof Postgres, 'testFindCountWithExpressions is not compatible with Postgres')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($this->db instanceof Postgres, 'testFindCountWithDbExpressions is not compatible with Postgres.');
|
||||
|
||||
$this->loadFixtures('Project');
|
||||
$db = ConnectionManager::getDataSource('test');
|
||||
$TestModel = new Project();
|
||||
|
@ -7470,9 +7462,8 @@ class ModelReadTest extends BaseModelTest {
|
|||
*
|
||||
*/
|
||||
public function testVirtualFieldsMysql() {
|
||||
if ($this->skipIf(!($this->db instanceof Mysql), 'The rest of virtualFieds test only compatible with Mysql')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!($this->db instanceof Mysql), 'The rest of virtualFieds test only compatible with Mysql.');
|
||||
|
||||
$this->loadFixtures('Post', 'Author');
|
||||
$Post = ClassRegistry::init('Post');
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
*/
|
||||
public function testAutoSaveUuid() {
|
||||
// SQLite does not support non-integer primary keys
|
||||
$this->skipIf($this->db instanceof Sqlite);
|
||||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with SQLite.');
|
||||
|
||||
$this->loadFixtures('Uuid');
|
||||
$TestModel = new Uuid();
|
||||
|
@ -168,7 +168,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
*/
|
||||
public function testSaveUuidNull() {
|
||||
// SQLite does not support non-integer primary keys
|
||||
$this->skipIf($this->db instanceof Sqlite);
|
||||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with SQLite.');
|
||||
|
||||
$this->loadFixtures('Uuid');
|
||||
$TestModel = new Uuid();
|
||||
|
@ -189,10 +189,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
public function testZeroDefaultFieldValue() {
|
||||
$this->skipIf(
|
||||
$this->db instanceof Sqlite,
|
||||
'%s SQLite uses loose typing, this operation is unsupported'
|
||||
);
|
||||
$this->skipIf($this->db instanceof Sqlite, 'SQLite uses loose typing, this operation is unsupported.');
|
||||
|
||||
$this->loadFixtures('DataTest');
|
||||
$TestModel = new DataTest();
|
||||
|
||||
|
@ -406,13 +404,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
public function testCounterCacheWithSelfJoin() {
|
||||
$skip = $this->skipIf(
|
||||
($this->db instanceof Sqlite),
|
||||
'SQLite 2.x does not support ALTER TABLE ADD COLUMN'
|
||||
);
|
||||
if ($skip) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf($this->db instanceof Sqlite, 'SQLite 2.x does not support ALTER TABLE ADD COLUMN');
|
||||
|
||||
$this->loadFixtures('CategoryThread');
|
||||
$column = 'COLUMN ';
|
||||
|
@ -3849,10 +3841,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
public function testUpdateAllWithJoins() {
|
||||
$this->skipIf(
|
||||
!$this->db instanceof Mysql,
|
||||
'%s Currently, there is no way of doing joins in an update statement in postgresql or sqlite'
|
||||
);
|
||||
$this->skipIf(!$this->db instanceof Mysql, 'Currently, there is no way of doing joins in an update statement in postgresql or sqlite');
|
||||
|
||||
$this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll');
|
||||
$ProductUpdateAll = new ProductUpdateAll();
|
||||
|
||||
|
@ -3899,10 +3889,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
* @return void
|
||||
*/
|
||||
function testUpdateAllWithoutForeignKey() {
|
||||
$this->skipIf(
|
||||
!$this->db instanceof Mysql,
|
||||
'%s Currently, there is no way of doing joins in an update statement in postgresql'
|
||||
);
|
||||
$this->skipIf(!$this->db instanceof Mysql, 'Currently, there is no way of doing joins in an update statement in postgresql');
|
||||
|
||||
$this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll');
|
||||
$ProductUpdateAll = new ProductUpdateAll();
|
||||
|
||||
|
|
|
@ -270,7 +270,8 @@ class CakeResponseTestCase extends CakeTestCase {
|
|||
*
|
||||
*/
|
||||
public function testCompress() {
|
||||
$this->skipIf(php_sapi_name() !== 'cli', 'The response compression can only be tested in cli');
|
||||
$this->skipIf(php_sapi_name() !== 'cli', 'The response compression can only be tested in cli.');
|
||||
|
||||
$response = new CakeResponse();
|
||||
if (ini_get("zlib.output_compression") === '1' || !extension_loaded("zlib")) {
|
||||
$this->assertFalse($response->compress());
|
||||
|
|
|
@ -1037,9 +1037,8 @@ class DispatcherTest extends CakeTestCase {
|
|||
*/
|
||||
public function testPluginShortCutUrlsWithControllerThatNeedsToBeLoaded() {
|
||||
$loaded = class_exists('TestPluginController', false);
|
||||
if ($this->skipIf($loaded, 'TestPluginController already loaded, this test will always pass, skipping %s')) {
|
||||
return true;
|
||||
}
|
||||
$this->skipIf($loaded, 'TestPluginController already loaded.');
|
||||
|
||||
Router::reload();
|
||||
App::build(array(
|
||||
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
||||
|
|
|
@ -294,10 +294,8 @@ class CakeTestFixtureTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testInitModelTablePrefix() {
|
||||
$hasPrefix = !empty($this->db->config['prefix']);
|
||||
if ($this->skipIf($hasPrefix, 'Cannot run this test, you have a database connection prefix.')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!empty($this->db->config['prefix']), 'Cannot run this test, you have a database connection prefix.');
|
||||
|
||||
$Source = new CakeTestFixtureTestFixture();
|
||||
$Source->create($this->db);
|
||||
$Source->insert($this->db);
|
||||
|
|
|
@ -111,7 +111,8 @@ class FileTest extends CakeTestCase {
|
|||
$result = $this->File->Folder();
|
||||
$this->assertIsA($result, 'Folder');
|
||||
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s File permissions tests not supported on Windows');
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.');
|
||||
|
||||
$result = $this->File->perms();
|
||||
$expecting = '0644';
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
|
|
@ -122,9 +122,8 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testRecursiveCreateFailure() {
|
||||
if ($this->skipIf(DS == '\\', 'Cant perform operations using permissions on windows. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'Cant perform operations using permissions on windows.');
|
||||
|
||||
$path = TMP . 'tests' . DS . 'one';
|
||||
mkdir($path);
|
||||
chmod($path, '0444');
|
||||
|
@ -218,7 +217,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testChmod() {
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Folder permissions tests not supported on Windows');
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'Folder permissions tests not supported on Windows.');
|
||||
|
||||
$path = CAKE . 'Console' . DS . 'templates' . DS . 'skel';
|
||||
$Folder = new Folder($path);
|
||||
|
|
|
@ -1647,10 +1647,8 @@ class ValidationTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testEmailDeep() {
|
||||
$found = gethostbynamel('example.abcd');
|
||||
if ($this->skipIf($found, 'Your DNS service responds for non-existant domains, skipping deep email checks. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(gethostbynamel('example.abcd'), 'Your DNS service responds for non-existant domains, skipping deep email checks.');
|
||||
|
||||
$this->assertTrue(Validation::email('abc.efg@cakephp.org', true));
|
||||
$this->assertFalse(Validation::email('abc.efg@caphpkeinvalid.com', true));
|
||||
$this->assertFalse(Validation::email('abc@example.abcd', true));
|
||||
|
|
|
@ -372,9 +372,8 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testImageTagWithTheme() {
|
||||
if ($this->skipIf(!is_writable(WWW_ROOT . 'theme'), 'Cannot write to webroot/theme')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!is_writable(WWW_ROOT . 'theme'), 'Cannot write to webroot/theme.');
|
||||
|
||||
App::uses('File', 'Utility');
|
||||
|
||||
$testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'img' . DS . '__cake_test_image.gif';
|
||||
|
@ -559,10 +558,8 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testScriptTimestamping() {
|
||||
$skip = $this->skipIf(!is_writable(JS), 'webroot/js is not Writable, timestamp testing has been skipped');
|
||||
if ($skip) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!is_writable(JS), 'webroot/js is not Writable, timestamp testing has been skipped.');
|
||||
|
||||
Configure::write('debug', 2);
|
||||
Configure::write('Asset.timestamp', true);
|
||||
|
||||
|
@ -653,9 +650,8 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testScriptInTheme() {
|
||||
if ($this->skipIf(!is_writable(WWW_ROOT . 'theme'), 'Cannot write to webroot/theme')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!is_writable(WWW_ROOT . 'theme'), 'Cannot write to webroot/theme.');
|
||||
|
||||
App::uses('File', 'Utility');
|
||||
|
||||
$testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'js' . DS . '__test_js.js';
|
||||
|
|
|
@ -315,9 +315,8 @@ class JsHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testWriteScriptsInFile() {
|
||||
if ($this->skipIf(!is_writable(JS), 'webroot/js is not Writable, script caching test has been skipped')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!is_writable(JS), 'webroot/js is not Writable, script caching test has been skipped.');
|
||||
|
||||
$this->Js->request->webroot = '/';
|
||||
$this->Js->JsBaseEngine = new TestJsEngineHelper($this->View);
|
||||
$this->Js->buffer('one = 1;');
|
||||
|
|
|
@ -611,10 +611,7 @@ class TimeHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testUserOffset() {
|
||||
if ($this->skipIf(!class_exists('DateTimeZone'), '%s DateTimeZone class not available.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->skipIf(!class_exists('DateTimeZone'), 'DateTimeZone class not available.');
|
||||
|
||||
$timezoneServer = new DateTimeZone(date_default_timezone_get());
|
||||
$timeServer = new DateTime('now', $timezoneServer);
|
||||
|
@ -744,9 +741,8 @@ class TimeHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testConvertPercentE() {
|
||||
if ($this->skipIf(DS !== '\\', 'Cannot run windows tests on non-windows OS')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(DIRECTORY_SEPARATOR !== '\\', 'Cannot run windows tests on non-windows OS.');
|
||||
|
||||
$time = strtotime('Thu Jan 14 11:43:39 2010');
|
||||
$result = $this->Time->convertSpecifiers('%e', $time);
|
||||
$expected = '14';
|
||||
|
|
|
@ -775,10 +775,8 @@ class ViewTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testRenderCache() {
|
||||
$writable = is_writable(CACHE . 'views' . DS);
|
||||
if ($this->skipIf(!$writable, 'CACHE/views dir is not writable, cannot test renderCache. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->skipIf(!is_writable(CACHE . 'views' . DS), 'CACHE/views dir is not writable, cannot test renderCache.');
|
||||
|
||||
$view = 'test_view';
|
||||
$View = new View($this->PostsController);
|
||||
$path = CACHE . 'views' . DS . 'view_cache_' . $view;
|
||||
|
|
Loading…
Reference in a new issue