Permalink
Browse files

Removing extra new lines.

Removing extra new lines and duplicated tests.
  • Loading branch information...
markstory committed Nov 17, 2011
1 parent 99793fd commit 2f599e8a2acd1903891e7492b9c8c51a13f4b9cf
Showing with 19 additions and 97 deletions.
  1. +19 −95 lib/Cake/Test/Case/BasicsTest.php
  2. +0 −2 lib/Cake/basics.php
@@ -683,70 +683,30 @@ public function testConvertSlash() {
*/
public function testDebug() {
ob_start();
debug('this-is-a-test');
debug('this-is-a-test', false);
$result = ob_get_clean();
$expectedHtml = <<<EXPECTED
<div class="cake-debug-output">
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
<pre class="cake-debug">
this-is-a-test
</pre>
</div>
EXPECTED;
$expectedText = <<<EXPECTED
%s (line %d)
########## DEBUG ##########
this-is-a-test
###########################
EXPECTED;
if (php_sapi_name() == 'cli') {
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 19);
} else {
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 21);
}
$this->assertEqual($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>');
$result = ob_get_clean();
$expectedHtml = <<<EXPECTED
<div class="cake-debug-output">
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
<pre class="cake-debug">
&lt;div&gt;this-is-a-test&lt;/div&gt;
</pre>
</div>
EXPECTED;
$expectedText = <<<EXPECTED
%s (line %d)
########## DEBUG ##########
<div>this-is-a-test</div>
###########################
EXPECTED;
if (php_sapi_name() == 'cli') {
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 19);
} else {
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 21);
}
$this->assertEqual($expected, $result);
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 8);
$this->assertEquals($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', true);
$result = ob_get_clean();
$expected = <<<EXPECTED
$expectedHtml = <<<EXPECTED
<div class="cake-debug-output">
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
<pre class="cake-debug">
&lt;div&gt;this-is-a-test&lt;/div&gt;
</pre>
</div>
EXPECTED;
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 10);
$this->assertEqual($expected, $result);
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 10);
$this->assertEquals($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', true, true);
@@ -774,33 +734,7 @@ public function testDebug() {
</div>
EXPECTED;
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 10);
$this->assertEqual($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', null);
$result = ob_get_clean();
$expectedHtml = <<<EXPECTED
<div class="cake-debug-output">
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
<pre class="cake-debug">
&lt;div&gt;this-is-a-test&lt;/div&gt;
</pre>
</div>
EXPECTED;
$expectedText = <<<EXPECTED
%s (line %d)
########## DEBUG ##########
<div>this-is-a-test</div>
###########################
EXPECTED;
if (php_sapi_name() == 'cli') {
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 19);
} else {
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 21);
}
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', null);
@@ -814,19 +748,17 @@ public function testDebug() {
</div>
EXPECTED;
$expectedText = <<<EXPECTED
%s (line %d)
########## DEBUG ##########
<div>this-is-a-test</div>
###########################
EXPECTED;
if (php_sapi_name() == 'cli') {
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 19);
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 17);
} else {
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 21);
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 19);
}
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', null, false);
@@ -841,60 +773,52 @@ public function testDebug() {
EXPECTED;
$expectedText = <<<EXPECTED
########## DEBUG ##########
<div>this-is-a-test</div>
###########################
EXPECTED;
if (php_sapi_name() == 'cli') {
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 19);
$expected = sprintf($expectedText, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 17);
} else {
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 21);
$expected = sprintf($expectedHtml, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 19);
}
$this->assertEqual($expected, $result);
$this->assertEquals($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', false);
$result = ob_get_clean();
$expected = <<<EXPECTED
%s (line %d)
########## DEBUG ##########
<div>this-is-a-test</div>
###########################
EXPECTED;
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 10);
$this->assertEqual($expected, $result);
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 8);
$this->assertEquals($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', false, true);
$result = ob_get_clean();
$expected = <<<EXPECTED
%s (line %d)
########## DEBUG ##########
<div>this-is-a-test</div>
###########################
EXPECTED;
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 10);
$this->assertEqual($expected, $result);
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 8);
$this->assertEquals($expected, $result);
ob_start();
debug('<div>this-is-a-test</div>', false, false);
$result = ob_get_clean();
$expected = <<<EXPECTED
########## DEBUG ##########
<div>this-is-a-test</div>
###########################
EXPECTED;
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 10);
$this->assertEqual($expected, $result);
$expected = sprintf($expected, substr(__FILE__, strlen(ROOT) + 1), __LINE__ - 8);
$this->assertEquals($expected, $result);
}
/**
@@ -91,12 +91,10 @@ function debug($var = false, $showHtml = null, $showFrom = true) {
</div>
HTML;
$text = <<<TEXT
%s
########## DEBUG ##########
%s
###########################
TEXT;
$template = $html;
if (php_sapi_name() == 'cli' || $showHtml === false) {

0 comments on commit 2f599e8

Please sign in to comment.