mockery - How can I prevent PHPUnit from running a PHP file in the Tests directory? -


i have lot of tests require particular mock object created. so, here i've done:

namespace appbundle\tests\services\terminal;  use mockery\adapter\phpunit\mockerytestcase; use appbundle\entity\tunnel; class tunnelbasedtestcase extends mockerytestcase {      /**      *      * @var tunnel      */     protected $tunnel;      protected function setup()     {         $tunnel = new tunnel();         $tunnel->setname('b9')             ->setip('192.168.2.52')             ->setusername('username')             ->setpassword('password')             ->setsign('sign')             ->setstatus('open');          $this->tunnel = $tunnel;     } } 

however, problem phpunit tries run test, meant prevent me copy-pasting setup() function. don't want skip it, because want green test result instead of getting like:

....s..... 

or this:

....i..... 

here phpunit configuration fails this:

<testsuites>     <testsuite name="project test suite">         <directory>../src/*/*bundle/tests</directory>         <directory>../src/*/bundle/*bundle/tests</directory>         <directory>../src/*bundle/tests</directory>         <exclude>../src/appbundle/tests/services/terminal/tunnelbasedtestcase.php</exclude>     </testsuite> </testsuites> 

how can this?

you can edit phpunit.xml this:

<?xml version="1.0" encoding="utf-8"?>  <phpunit>      <testsuites>         <testsuite name="foo">             <directory>./tests/</directory>             <exclude>./tests/path/to/excluded/test.php</exclude>                 ^-------------         </testsuite>     </testsuites>  </phpunit> 

you can try make blacklist this:

<filter>     <blacklist>           <file>../src/appbundle/tests/services/terminal/tunnelbasedtestcase.php</file>     </blacklist> </filter> 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -