{"id":3551,"date":"2014-03-28T10:36:01","date_gmt":"2014-03-28T10:36:01","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/phpunit-failed-asserting-last-controller-used-error-collection-of-common-programming-errors\/"},"modified":"2014-03-28T10:36:01","modified_gmt":"2014-03-28T10:36:01","slug":"phpunit-failed-asserting-last-controller-used-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/phpunit-failed-asserting-last-controller-used-error-collection-of-common-programming-errors\/","title":{"rendered":"PHPUnit: Failed asserting last controller used &lt;&ldquo;error&rdquo;&gt;-Collection of common programming errors"},"content":{"rendered":"<p>I am working on a ZF project wich use a postgre database, on my local server (ubuntu 10.04 LTS Lucid Lynx).<\/p>\n<p>I&#8217;m trying to run a very simple test with phpunit:<\/p>\n<pre><code>    public function testIndexAction() {\n        $this-&gt;dispatch('\/');  \n        $this-&gt;assertController('index');  \n        $this-&gt;assertAction('index');  \n        $this-&gt;assertModule('default');  \n        $this-&gt;assertXpathContentContains('\/html\/body\/div[1]\/div[@id=\\'content\\']\/p', 'Los puntos de mis amigos son mis amigos..');  \n    }<\/code><\/pre>\n<p>but it fails on the first assertion with this message:<\/p>\n<blockquote><p>Failed asserting last controller used was &#8220;index&#8221;<\/p><\/blockquote>\n<p>I found this question where the author had the same problem: he solved it by adding to his 2nd php.ini the php_pdo_pgsql.dll library. But he&#8217;s on windows and using xampp.<br \/>\nAnyway I checked it: the <strong>\/etc\/php5\/apache2\/php.ini<\/strong> has those 3 lines:<\/p>\n<pre><code>extension=msql.so\nextension=pgsql.so\nextension=pdo_pgsql.so<\/code><\/pre>\n<p>and I added them in the other php.ini file I found: <strong>\/etc\/php5\/cli\/php.ini<\/strong> and now when I run the test it says:<\/p>\n<pre>PHP Warning:  PHP Startup: Unable to load dynamic library '\/usr\/lib\/php5\/20090626+lfs\/msql.so' - \/usr\/lib\/php5\/20090626+lfs\/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0\nPHP Warning:  PHP Startup: Unable to load dynamic library '\/usr\/lib\/php5\/20090626+lfs\/pdo_pgsql.so' - \/usr\/lib\/php5\/20090626+lfs\/pdo_pgsql.so: undefined symbol: php_pdo_register_driver in Unknown on line 0\nPHP Warning:  Module 'pgsql' already loaded in Unknown on line 0\n<\/pre>\n<p>and now I&#8221;m realy out of ideas&#8230; Can anyone point me in the right direction?<\/p>\n<p>thx<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am working on a ZF project wich use a postgre database, on my local server (ubuntu 10.04 LTS Lucid Lynx). I&#8217;m trying to run a very simple test with phpunit: public function testIndexAction() { $this-&gt;dispatch(&#8216;\/&#8217;); $this-&gt;assertController(&#8216;index&#8217;); $this-&gt;assertAction(&#8216;index&#8217;); $this-&gt;assertModule(&#8216;default&#8217;); $this-&gt;assertXpathContentContains(&#8216;\/html\/body\/div[1]\/div[@id=\\&#8217;content\\&#8217;]\/p&#8217;, &#8216;Los puntos de mis amigos son mis amigos..&#8217;); } but it fails on the first [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3551","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3551"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3551\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}