Browse Source

ZF-9000
- Fixed failing test cases in components affected by Zend_View changes

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21141 44c647ce-9c0f-0410-b52a-842ac1e357ba

ralph 16 years ago
parent
commit
f669e68490

+ 1 - 1
tests/Zend/Application/Resource/ViewTest.php

@@ -115,7 +115,7 @@ class Zend_Application_Resource_ViewTest extends PHPUnit_Framework_TestCase
         $resource->init();
         $view  = $resource->getView();
         $paths = $view->getScriptPaths();
-        $this->assertContains(dirname(__FILE__) . DIRECTORY_SEPARATOR, $paths, var_export($paths, 1));
+        $this->assertContains(dirname(__FILE__) . '/', $paths, var_export($paths, 1));
     }
 
     public function testDoctypeIsSet()

+ 19 - 6
tests/Zend/Controller/Action/Helper/ViewRendererTest.php

@@ -278,7 +278,10 @@ class Zend_Controller_Action_Helper_ViewRendererTest extends PHPUnit_Framework_T
 
         $scriptPaths = $this->helper->view->getScriptPaths();
         $scriptPath  = $scriptPaths[0];
-        $this->assertContains($viewDir, $scriptPath);
+        $this->assertContains(
+            $this->_normalizePath($viewDir),
+            $this->_normalizePath($scriptPath)
+            );
 
         $helperPaths = $this->helper->view->getHelperPaths();
         $found       = false;
@@ -786,9 +789,11 @@ class Zend_Controller_Action_Helper_ViewRendererTest extends PHPUnit_Framework_T
 
         $viewScriptPaths = $this->helper->view->getAllPaths();
 
-        // we need this until View decides to not use DIRECTORY_SEPARATOR
-        $expectedPathRegex = (DIRECTORY_SEPARATOR == '\\') ? '#modules\\\\bar\\\\bar\\\\scripts\\\\$#' : '#modules/bar/bar/scripts/$#';
-        $this->assertRegExp($expectedPathRegex, $viewScriptPaths['script'][0]);
+        $expectedPathRegex = '#modules/bar/bar/scripts/$#';
+        $this->assertRegExp(
+            $expectedPathRegex,
+            $this->_normalizePath($viewScriptPaths['script'][0])
+            );
         $this->assertEquals($this->helper->getViewScript(), 'index/admin.phtml');
     }
 
@@ -804,8 +809,11 @@ class Zend_Controller_Action_Helper_ViewRendererTest extends PHPUnit_Framework_T
         $this->helper->setActionController($controller);
         $viewScriptPaths = $this->helper->view->getAllPaths();
 
-        $expectedPathRegex = (DIRECTORY_SEPARATOR == '\\') ? '#modules\\\\foo\\\\views\\\\scripts\\\\$#' : '#modules/foo/views/scripts/$#';
-        $this->assertRegExp($expectedPathRegex, $viewScriptPaths['script'][0]);
+        $expectedPathRegex = '#modules/foo/views/scripts/$#';
+        $this->assertRegExp(
+            $expectedPathRegex,
+            $this->_normalizePath($viewScriptPaths['script'][0])
+            );
         $this->assertEquals('car-bar/baz.phtml', $this->helper->getViewScript());
     }
 
@@ -833,6 +841,11 @@ class Zend_Controller_Action_Helper_ViewRendererTest extends PHPUnit_Framework_T
         $body = $this->response->getBody();
         $this->assertContains('SampleZfHelper invoked', $body, 'Received ' . $body);
     }
+    
+    protected function _normalizePath($path)
+    {
+        return str_replace(array('/', '\\'), '/', $path);
+    }
 }
 
 // Call Zend_Controller_Action_Helper_ViewRendererTest::main() if this source file is executed directly.

+ 1 - 1
tests/Zend/Controller/ActionTest.php

@@ -290,7 +290,7 @@ class Zend_Controller_ActionTest extends PHPUnit_Framework_TestCase
         $this->assertTrue($view instanceof Zend_View);
         $scriptPath = $view->getScriptPaths();
         $this->assertTrue(is_array($scriptPath));
-        $this->assertEquals(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR, $scriptPath[0]);
+        $this->assertEquals(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'scripts/', $scriptPath[0]);
     }
 
     public function testRender()

BIN
tests/Zend/Paginator/_files/test.sqlite