Note that there are some explanatory texts on larger screens.

plurals
  1. POZend Framework UnitTest
    primarykey
    data
    text
    <p>I tried to use Zend_Test_PHPUnit to write unit tests for my application, but I always just get </p> <pre><code>1) IndexControllerTest::testValidation Failed asserting last controller used &lt;"error"&gt; was "test" </code></pre> <p>I have created a test controller but even there I cannot get it to work.</p> <p>Can anyone help?</p> <p>Thanks!</p> <pre><code>class TestController extends Zend_Controller_Action { public function indexAction() { print 'test'; } } </code></pre> <p>Bootstrap is:</p> <pre><code>// Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing')); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( realpath(APPLICATION_PATH . '/../library'), get_include_path(), ))); </code></pre> <p>require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance();</p> <p>phpunit.xml is:</p> <pre><code>&lt;phpunit bootstrap="./bootstrap.php"&gt; &lt;testsuite name="Application Test Suite"&gt; &lt;directory&gt;./application&lt;/directory&gt; &lt;/testsuite&gt; &lt;testsuite name="Library Test Suite"&gt; &lt;directory&gt;./library&lt;/directory&gt; &lt;/testsuite&gt; &lt;filter&gt; &lt;whitelist&gt; &lt;directory suffix=".php"&gt;../library/&lt;/directory&gt; &lt;directory suffix=".php"&gt;../application/&lt;/directory&gt; &lt;/whitelist&gt; &lt;/filter&gt; &lt;/phpunit&gt; </code></pre> <p>Test controller is</p> <pre><code>class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase { public function setUp() { $this-&gt;bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); parent::setUp(); } public function testValidation() { $this-&gt;dispatch('/test/'); $this-&gt;assertController("test"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload