Permalink
Browse files

Pattern to use skipIf in tests.

  • Loading branch information...
1 parent ed96936 commit aacb92169593058fd6d0a367b489b73c121554ec @jrbasso jrbasso committed May 31, 2011
Showing with 92 additions and 156 deletions.
  1. +4 −8 lib/Cake/Test/Case/BasicsTest.php
  2. +6 −7 lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php
  3. +2 −3 lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
  4. +4 −4 lib/Cake/Test/Case/Cache/Engine/MemcacheTest.php
  5. +2 −3 lib/Cake/Test/Case/Console/Command/BakeShellTest.php
  6. +4 −4 lib/Cake/Test/Case/Console/Command/ShellTest.php
  7. +4 −10 lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
  8. +2 −4 lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
  9. +2 −2 lib/Cake/Test/Case/Console/ShellDispatcherTest.php
  10. +2 −4 lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
  11. +3 −6 lib/Cake/Test/Case/Error/ErrorHandlerTest.php
  12. +2 −4 lib/Cake/Test/Case/I18n/MultibyteTest.php
  13. +3 −7 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
  14. +6 −9 lib/Cake/Test/Case/Model/CakeSchemaTest.php
  15. +1 −0 lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
  16. +10 −19 lib/Cake/Test/Case/Model/ModelReadTest.php
  17. +9 −21 lib/Cake/Test/Case/Model/ModelWriteTest.php
  18. +2 −1 lib/Cake/Test/Case/Network/CakeResponseTest.php
  19. +2 −3 lib/Cake/Test/Case/Routing/DispatcherTest.php
  20. +2 −4 lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
  21. +2 −1 lib/Cake/Test/Case/Utility/FileTest.php
  22. +3 −4 lib/Cake/Test/Case/Utility/FolderTest.php
  23. +2 −4 lib/Cake/Test/Case/Utility/ValidationTest.php
  24. +6 −10 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
  25. +2 −3 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
  26. +3 −7 lib/Cake/Test/Case/View/Helper/TimeHelperTest.php
  27. +2 −4 lib/Cake/Test/Case/View/ViewTest.php
View
12 lib/Cake/Test/Case/BasicsTest.php
@@ -85,7 +85,7 @@ public function testArrayDiffKey() {
* @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 @@ public function testAm() {
*/
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 @@ public function testCache() {
*/
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 @@ public function testPr() {
* @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');
View
13 lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php
@@ -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 @@ public function testDeleteCache() {
* @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 @@ public function testDecrement() {
* @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);
View
5 lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
@@ -332,9 +332,8 @@ public function testWriteQuotedString() {
* @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',
View
8 lib/Cake/Test/Case/Cache/Engine/MemcacheTest.php
@@ -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 @@ public function testMultipleServers() {
}
}
- 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));
View
5 lib/Cake/Test/Case/Console/Command/BakeShellTest.php
@@ -77,9 +77,8 @@ public function tearDown() {
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));
View
8 lib/Cake/Test/Case/Console/Command/ShellTest.php
@@ -507,7 +507,7 @@ public function testShortPath() {
* @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 @@ public function testCreateFileNonInteractive() {
* @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 @@ public function testCreateFileInteractive() {
* @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 @@ public function testCreateFileWindowsNonInteractive() {
* @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';
View
14 lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
@@ -329,11 +329,8 @@ public function testBakeWithPlugin() {
* @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 @@ public function testBakeActionsUsingSessions() {
* @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);
View
6 lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
@@ -374,10 +374,8 @@ public function testRegistryClearWhenBuildingTestObjects() {
*/
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));
View
4 lib/Cake/Test/Case/Console/ShellDispatcherTest.php
@@ -392,8 +392,8 @@ public function testParseParams() {
* @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();
View
6 lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
@@ -602,10 +602,8 @@ public function testContentStripping() {
* @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');
View
9 lib/Cake/Test/Case/Error/ErrorHandlerTest.php
@@ -186,9 +186,7 @@ public function testHandleErrorLoggingTrace() {
* @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 @@ public function testHandleException() {
* @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');
}
View
6 lib/Cake/Test/Case/I18n/MultibyteTest.php
@@ -4794,10 +4794,8 @@ public function testMultibyteStrripos() {
* @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);
View
10 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
@@ -3500,15 +3500,11 @@ public function testResetMultipleHabtmAssociations() {
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);
View
15 lib/Cake/Test/Case/Model/CakeSchemaTest.php
@@ -610,7 +610,8 @@ public function testSchemaRead() {
*/
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 @@ public function testSchemaReadWithOddTablePrefix() {
*/
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 @@ public function testSchemaReadWithPlugins() {
*/
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();
View
1 lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
@@ -820,6 +820,7 @@ public function testFieldsUsingMethodCache() {
*/
public function testStatements() {
$this->skipIf(!$this->testDb instanceof DboMysql);
+
$this->loadFixtures('Article', 'User', 'Comment', 'Tag', 'Attachment', 'ArticlesTag');
$Article = new Article();
View
29 lib/Cake/Test/Case/Model/ModelReadTest.php
@@ -82,9 +82,7 @@ public function testGroupBy() {
$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 @@ public function testVeryStrangeUseCase() {
* @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 @@ public function testFindNeighbors() {
* @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 @@ public function testFindAllWithConditionsHavingMixedDataTypes() {
$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 @@ public function testFindFirstNoIdUsed() {
* @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 @@ public function testFindCountDistinct() {
* @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 @@ public function testVirtualFields() {
*
*/
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');
View
30 lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -146,7 +146,7 @@ public function testUnderscoreFieldSave() {
*/
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 @@ public function testAutoSaveUuid() {
*/
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 @@ public function testSaveUuidNull() {
* @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 @@ public function testCounterCacheWithNonstandardPrimaryKey() {
* @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 @@ public function testUpdateAllEmptyValues() {
* @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 @@ public function testUpdateAllWithJoins() {
* @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();
View
3 lib/Cake/Test/Case/Network/CakeResponseTest.php
@@ -270,7 +270,8 @@ public function testCache() {
*
*/
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());
View
5 lib/Cake/Test/Case/Routing/DispatcherTest.php
@@ -1037,9 +1037,8 @@ public function testAutomaticPluginDispatchWithShortAccess() {
*/
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)
View
6 lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
@@ -294,10 +294,8 @@ public function testInitDbPrefixDuplication() {
* @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);
View
3 lib/Cake/Test/Case/Utility/FileTest.php
@@ -111,7 +111,8 @@ public function testBasic() {
$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);
View
7 lib/Cake/Test/Case/Utility/FolderTest.php
@@ -122,9 +122,8 @@ public function testCreateWithTrailingDs() {
* @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 @@ public function testOperations() {
* @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);
View
6 lib/Cake/Test/Case/Utility/ValidationTest.php
@@ -1647,10 +1647,8 @@ public function testEmail() {
* @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));
View
16 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -372,9 +372,8 @@ public function testImageWithTimestampping() {
* @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 @@ public function testCssTimestamping() {
* @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 @@ public function testScript() {
* @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';
View
5 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
@@ -315,9 +315,8 @@ public function testWriteBufferAndXhr() {
* @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;');
View
10 lib/Cake/Test/Case/View/Helper/TimeHelperTest.php
@@ -611,10 +611,7 @@ public function testWasWithinLast() {
* @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 @@ public function testConvertSpecifiers() {
* @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';
View
6 lib/Cake/Test/Case/View/ViewTest.php
@@ -775,10 +775,8 @@ public function testViewFileName() {
* @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;

0 comments on commit aacb921

Please sign in to comment.