2
0
Quellcode durchsuchen

ZF-8852: fixed eol problem within unit tests of Zend_View_Helper

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20375 44c647ce-9c0f-0410-b52a-842ac1e357ba
mabe vor 16 Jahren
Ursprung
Commit
16fc7e4b7b

+ 4 - 4
tests/Zend/View/Helper/HeadLinkTest.php

@@ -456,10 +456,10 @@ class Zend_View_Helper_HeadLinkTest extends PHPUnit_Framework_TestCase
 
         $test = $this->helper->toString();
 
-        $expected = '<link href="/test1.css" media="screen" rel="stylesheet" type="text/css" >
-<link href="/test4.css" media="screen" rel="stylesheet" type="text/css" >
-<link href="/test2.css" media="screen" rel="stylesheet" type="text/css" >
-<link href="/test3.css" media="screen" rel="stylesheet" type="text/css" >';
+        $expected = '<link href="/test1.css" media="screen" rel="stylesheet" type="text/css" >' . PHP_EOL
+                  . '<link href="/test4.css" media="screen" rel="stylesheet" type="text/css" >' . PHP_EOL
+                  . '<link href="/test2.css" media="screen" rel="stylesheet" type="text/css" >' . PHP_EOL
+                  . '<link href="/test3.css" media="screen" rel="stylesheet" type="text/css" >';
 
         $this->assertEquals($expected, $test);
     }

+ 11 - 11
tests/Zend/View/Helper/HeadMetaTest.php

@@ -428,42 +428,42 @@ class Zend_View_Helper_HeadMetaTest extends PHPUnit_Framework_TestCase
 
         $test = $this->helper->toString();
 
-        $expected = '<meta name="keywords" content="foo" />
-<meta http-equiv="Cache-control" content="baz" />
-<meta name="description" content="foo" />
-<meta http-equiv="pragma" content="baz" />';
+        $expected = '<meta name="keywords" content="foo" />' . PHP_EOL
+                  . '<meta http-equiv="Cache-control" content="baz" />' . PHP_EOL
+                  . '<meta name="description" content="foo" />' . PHP_EOL
+                  . '<meta http-equiv="pragma" content="baz" />';
 
         $this->assertEquals($expected, $test);
     }
-	
+
 	/**
 	 * @issue ZF-7722
 	 */
-	public function testCharsetValidateFail() 
+	public function testCharsetValidateFail()
 	{
 		$view = new Zend_View();
 		$view->doctype('HTML4_STRICT');
-		
+
 		try {
 			$view->headMeta()->setCharset('utf-8');
 			$this->fail('Should not be able to set charset for a HTML4 doctype');
 		} catch (Zend_View_Exception $e) {}
 	}
-	
+
 	/**
 	 * @issue ZF-7722
 	 */
 	public function testCharset() {
 		$view = new Zend_View();
 		$view->doctype('HTML5');
-		
+
 		$view->headMeta()->setCharset('utf-8');
 		$this->assertEquals(
 			'<meta charset="utf-8">',
 			$view->headMeta()->toString());
-			
+
 		$view->doctype('XHTML5');
-		
+
 		$this->assertEquals(
 			'<meta charset="utf-8"/>',
 			$view->headMeta()->toString());

+ 14 - 25
tests/Zend/View/Helper/HeadStyleTest.php

@@ -427,34 +427,23 @@ a {
     public function testContainerMaintainsCorrectOrderOfItems()
     {
 
-        $this->helper->offsetSetStyle(10, '
-a {
-    display: none;
-}');
-        $this->helper->offsetSetStyle(5, '
-h1 {
-    font-weight: bold
-}');
+        $style1 = 'a {display: none;}';
+        $this->helper->offsetSetStyle(10, $style1);
 
+        $style2 = 'h1 {font-weight: bold}';
+        $this->helper->offsetSetStyle(5, $style2);
 
         $test = $this->helper->toString();
-
-        $expected = '<style type="text/css" media="screen">
-<!--
-
-h1 {
-    font-weight: bold
-}
--->
-</style>
-<style type="text/css" media="screen">
-<!--
-
-a {
-    display: none;
-}
--->
-</style>';
+        $expected = '<style type="text/css" media="screen">' . PHP_EOL
+                  . '<!--' . PHP_EOL
+                  . $style2 . PHP_EOL
+                  . '-->' . PHP_EOL
+                  . '</style>' . PHP_EOL
+                  . '<style type="text/css" media="screen">' . PHP_EOL
+                  . '<!--' . PHP_EOL
+                  . $style1 . PHP_EOL
+                  . '-->' . PHP_EOL
+                  . '</style>';
 
         $this->assertEquals($expected, $test);
     }

+ 9 - 7
tests/Zend/View/Helper/Navigation/LinksTest.php

@@ -637,11 +637,11 @@ class Zend_View_Helper_Navigation_LinksTest
 
             $this->_helper->setRenderFlag($newFlag);
             $expectedOutput = '<link '
-                      . 'rel="' . $type . '" '
-                      . 'href="http://www.example.com/">' . PHP_EOL
-                      . '<link '
-                      . 'rev="' . $type . '" '
-                      . 'href="http://www.example.com/">';
+                              . 'rel="' . $type . '" '
+                              . 'href="http://www.example.com/">' . constant($this->_helperName.'::EOL')
+                            . '<link '
+                              . 'rev="' . $type . '" '
+                              . 'href="http://www.example.com/">';
             $actualOutput = $this->_helper->render();
 
             $expected[$type] = $expectedOutput;
@@ -664,7 +664,8 @@ class Zend_View_Helper_Navigation_LinksTest
         $active->active = true;
 
         // test data
-        $expected = '<link rel="next" href="page2" title="Page 2">' . PHP_EOL
+        $expected = '<link rel="next" href="page2" title="Page 2">'
+                  . constant($this->_helperName.'::EOL')
                   . '<link rel="prev" href="page1" title="Page 1">';
         $actual = $this->_helper->render();
 
@@ -681,7 +682,8 @@ class Zend_View_Helper_Navigation_LinksTest
         $active->active = true;
 
         // build expected and actual result
-        $expected = '  <link rel="next" href="page2" title="Page 2">' . PHP_EOL
+        $expected = '  <link rel="next" href="page2" title="Page 2">'
+                  . constant($this->_helperName.'::EOL')
                   . '  <link rel="prev" href="page1" title="Page 1">';
         $actual = $this->_helper->render();
 

+ 1 - 1
tests/Zend/View/Helper/Navigation/NavigationTest.php

@@ -370,7 +370,7 @@ class Zend_View_Helper_Navigation_NavigationTest
                   . '    <li>' . $nl
                   . '        <a id="menu-p1" href="p1">Page 1</a>' . $nl
                   . '    </li>' . $nl
-                  . '    <li>' . PHP_EOL
+                  . '    <li>' . $nl
                   . '        <a id="menu-p2" href="p2">Page 2</a>' . $nl
                   . '    </li>' . $nl
                   . '</ul>';

+ 1 - 1
tests/Zend/View/Helper/Navigation/_files/mvc/views/menu.phtml

@@ -9,5 +9,5 @@ foreach ($this->container as $page) {
 }
 $pages = implode(', ', $pages);
 ?>
-Is a container: <?php echo $isContainer, PHP_EOL; ?>
+Is a container: <?php echo $isContainer . "\n"; ?>
 Pages: <?php echo $pages; ?>