mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Changing tests in order to works in both Linux and Windows.
Using correcly syntax of javascript->block. Commenting no:cache test, it must be fixed in 1.2+. git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7849 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
111b886570
commit
3223ba55cc
3 changed files with 18 additions and 11 deletions
|
@ -93,13 +93,13 @@ class FileTest extends CakeTestCase {
|
|||
$expecting = filegroup($file);
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
$result = $this->File->perms();
|
||||
$expecting = '0644';
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
$result = $this->File->Folder();
|
||||
$this->assertIsA($result, 'Folder');
|
||||
|
||||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows');
|
||||
$result = $this->File->perms();
|
||||
$expecting = '0644';
|
||||
$this->assertEqual($result, $expecting);
|
||||
}
|
||||
/**
|
||||
* testRead method
|
||||
|
@ -234,7 +234,12 @@ class FileTest extends CakeTestCase {
|
|||
*/
|
||||
function testPrepare() {
|
||||
$string = "some\nvery\ncool\r\nteststring here\n\n\nfor\r\r\n\n\r\n\nhere";
|
||||
$expected = "some\nvery\ncool\nteststring here\n\n\nfor\n\n\n\n\nhere";
|
||||
if (DS == '\\') {
|
||||
$expected = "some\r\nvery\r\ncool\r\nteststring here\r\n\r\n\r\n";
|
||||
$expected .= "for\r\n\r\n\r\n\r\n\r\nhere";
|
||||
} else {
|
||||
$expected = "some\nvery\ncool\nteststring here\n\n\nfor\n\n\n\n\nhere";
|
||||
}
|
||||
$this->assertIdentical(File::prepare($string), $expected);
|
||||
|
||||
$expected = "some\r\nvery\r\ncool\r\nteststring here\r\n\r\n\r\n";
|
||||
|
|
|
@ -196,9 +196,11 @@ class CacheHelperTest extends CakeTestCase {
|
|||
/**
|
||||
* testCacheEmptySections method
|
||||
*
|
||||
* This test must be uncommented/fixed in next release (1.2+)
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
*
|
||||
function testCacheEmptySections () {
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->cacheAction = array('cacheTest' => 21600);
|
||||
|
@ -235,7 +237,7 @@ class CacheHelperTest extends CakeTestCase {
|
|||
'@', $contents);
|
||||
@unlink($filename);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* End Case - restore view Paths
|
||||
*
|
||||
|
|
|
@ -386,25 +386,25 @@ class JavascriptTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testScriptBlock() {
|
||||
$result = $this->Javascript->codeBlock('something', true, false);
|
||||
$result = $this->Javascript->codeBlock('something', array('allowCache' => true, 'safe' => false));
|
||||
$this->assertPattern('/^<script[^<>]+>something<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript">something<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/^<script[^type]=[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Javascript->codeBlock('something', false, false);
|
||||
$result = $this->Javascript->codeBlock('something', array('allowCache' => false, 'safe' => false));
|
||||
$this->assertPattern('/^<script[^<>]+>something<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript">something<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/^<script[^type]=[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Javascript->codeBlock('something', true, true);
|
||||
$result = $this->Javascript->codeBlock('something', true);
|
||||
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript">\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/^<script[^type]=[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Javascript->codeBlock('something', false, true);
|
||||
$result = $this->Javascript->codeBlock('something', false);
|
||||
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript">\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*something\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
|
|
Loading…
Reference in a new issue