Hi.
I have the following code in one of my unit tests for testing controller
functionality:
<?php
require_once "TestHelper.php";
class CategoryControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
{
protected $_controller;
public function setUp()
{
$this->bootstrap = array($this, 'appBootstrap');
parent::setUp();
$this->loginUser();
}
public function appBootstrap()
{
$config = Zend_Registry::get('config');
Zend_Layout::startMvc(array('layoutPath' =>
ROOT_DIR.'/application/views/layouts') );
$this->_controller = $this->getFrontController();
$this->_controller->registerPlugin(new
App_Controller_Plugin_Bootstrap($config) );
}
public function loginUser()
{
$user = 'foo';
$password = 'bar';
$request = $this->getRequest();
$request->setMethod('POST')
->setPost(array(
'username' => $user,
'password' => $password,
));
$this->dispatch('/en/login/login');
$this->resetResponse();
$request->setPost(array());
}
public function testInitialValuesShouldBeResetInCreate()
{
$this->dispatch('/en/category/create');
}
public function testCategoryShouldHaveAnErrorMessagesss()
{
$this->dispatch('/en/category/create'); // FAILS
}
public function tearDown()
{
}
}
?>
As seen in the code, the two existing tests run the same dispatch. The first
test runs fine but when the second test is executed, I get
"Zend_View_Exception: script 'lang_tpl.phtml' not found in path ..."
This I don't understand. Two tests that perform the same action and yet the
second one fails. Am I missing something?
--
View this message in context:
http://www.nabble.com/Problems-with-running-controller-unit-tests---one-of-two-tests-fail-although-they-execute-very-same-code-tp20562100p20562100.html
Sent from the Zend Framework mailing list archive at Nabble.com.