Note that there are some explanatory texts on larger screens.

plurals
  1. POZF-Autoloader not working in UnitTests on Ubuntu
    primarykey
    data
    text
    <p>i got a problem regarding Unit-testing a Zend-Framework application under Ubuntu 12.04. The project-structure is a default zend application whereas the models are defined as the following</p> <pre><code>./application ./models ./DbTable ./ProjectStatus.php (Application_Model_DbTable_ProjectStatus) ./Mappers ./ProjectStatus.php (Application_Model_Mapper_ProjectStatus) ./ProjectStatus.php (Application_Model_ProjectStatus) </code></pre> <p>The Problem here is with the Zend-specific autoloading. The naming convention here appears that the folder <strong>Mappers</strong> loads all classes with <strong>_Mapper</strong> but not <strong>_Mappers</strong>. This is some internal Zend behavior which is fine so far.</p> <p>On my windows machine the phpunit runs without any Problems, trying to initiate all those classes.</p> <p>On my Ubuntu machine however with jenkins running on it, phpunit fails to find the appropriate classes giving me the following error</p> <pre><code>Fatal error: Class 'Application_Model_Mapper_ProjectStatus' not found in /var/lib/jenkins/jobs/PAM/workspace/tests/application/models/Mapper/ProjectStatusTest.php on line 39 </code></pre> <p>The error appears to really be that the Zend-Autoloader doesn't load from the ubuntu machine, but i can't figure out how or why this works. The question remains of why this is. I think i've double checked every point of contact with the zend autoloading stuff, but i just can't figure this out. I'll paste the - from my point of view relevant snippets - and hope someone of you has any insight to this.</p> <p><strong>Jenkins Snippet for PHPUnit</strong></p> <pre><code> &lt;target name="phpunit" description="Run unit tests with PHPUnit"&gt; &lt;exec executable="phpunit" failonerror="true"&gt; &lt;arg line="--configuration '${basedir}/tests/phpunit.xml' --coverage-clover '${basedir}/build/logs/clover.xml' --coverage-html '${basedir}/build/coverage/.' --log-junit '${basedir}/build/logs/junit.xml'" /&gt; &lt;/exec&gt; &lt;/target&gt; </code></pre> <p><strong>./tests/phpunit.xml</strong></p> <pre><code>&lt;phpunit bootstrap="./bootstrap.php"&gt; ... this shouldn't be of relevance ... &lt;/phpunit&gt; </code></pre> <p><strong>./tests/bootstrap.php</strong></p> <pre><code>&lt;?php // 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(), ))); require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance(); </code></pre> <p>Any help will be appreciated.</p>
    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.
    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