PHPUnit can't instantiate real class after mocking

After I mock a class in one unit test, I can not use the real class in another unit test anymore.It is the same problem as here, but the answer isn't relevant.PHPUnit Mock Object replacing Real ClassI have two unit tests:class BarServiceTest { function setUp() { $this->fooService = $this->getMock('Application\Service\FooService', ['fooMethod'], [],'MockFooService', false, false, false); }}And:class FooServiceTest { function setUp() { $this->fooService = new \Application\Service\FooService; }}When FooServiceTest runs, the fooS...Read more

zend test - PHPUnit Mock Object replacing Real Class

I have a couple of tests in my test suite being run in Zend_TestOne test creates a mock of Foo_Bar_Baz via PHPUnit's MockBuilder as that class its dependency. Now in the test for Foo_BAR_baz (the change in case is on purpose and is necessary due to autoloading), I am not getting the class but rather an instance of the mock, which obviously doesn't work.Doing a var_dump on the object results in class Foo_Bar_Baz#27115(0) { } so it appears to be creating an instance of the mock.Fixing the case of in the mock gets things to work as expected. I h...Read more

PHPUnit vary mock method return value based on arguments

Does PHPUnit not allow me to specify returns values based on the arguments passed in. The following gives a 500 error:// mock session values$container->get('session') ->method('get') ->with(SESSION_FILTER_MONTH) ->willReturn('2017-05');$container->get('session') ->method('get') ->with(SESSION_FILTER_FUND) ->willReturn(1);In my app, the following line throws the exception:$fundId = $container->get('session')->get(SESSION_FILTER_MONTH); // works OK$fundId = $container->get('session')->get(SESS...Read more

phpunit - CruiseControl / phpUnderControl Artifacts issues

I have set up Git and CruiseControl, and just finished getting phpUnderControl working (a nightmare in itself as it is missing packages and all sorts).So I have all the plugins in it like phpunit and php-documentor.When I run 'ant' on my project it builds fine (just to check my build.xml is good)When running the build from PHPUnderControl it hangs on the graph generation[cc]Sep-08 01:10:22 ecutePublisher- executing command: /root/phpUnderControl/bin/phpuc.php graph logs/BIOSYNERGY artifacts/BIOSYNERGYAnd it sits here for hours, in 'publishing' ...Read more

cruisecontrol - PHPUnit Problems When Installing phpUnderControl On Windows

having problems here getting phpUnderControl running on my Windows 7 machine, been searching all over the net for answers but documentation to many of the problems is just really bad...(a.) Cruise Control is installed as a Windows service and up & running--> location: C:\Program Files (x86)\CruiseControl(b.) phpUnderControl is installed via Pear--> Pear location is C:\wamp\bin\php\PEAR(c.) Configured CruiseControl for phpUnderControl phpuc install "C:\Program Files (x86)\CruiseControl"(d.) now when I try to create the phpUnderControl examp...Read more

cruisecontrol - phpUnderControl and PHPUnit always failing build with code 255

I have the following build.xml file setup in phpUnderControl. <target name="phpunit"> <exec executable="phpunit" dir="${basedir}/httpdocs" failonerror="on"> <arg line="--log-junit ${basedir}/build/logs/phpunit.xml --coverage-clover ${basedir}/build/logs/phpunit.coverage.xml --coverage-html ${basedir}/build/coverage --colors ${basedir}/httpdocs/qc/unit/CalculatorTest.php" /> </exec></target>For some unkown reason the build always fails with ...Read more

cruisecontrol phpunit creates no output

I cannot seem to figure out why the phpunit target does not output any test results even though I have tests in position.The problem I am finding is there is no indication as to what the problem is! Incredibly frustrating.The output is as follows:<build error="C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml:46: exec returned: 255" time="1 second"> <message priority="debug"><![CDATA[Adding reference: ant.PropertyHelper]]></message> <message priority="debug"><![CDATA[Detected Java version: ...Read more

Need help installing PHPunit with composer

I am trying to install PHPunit using composer and I keep on getting the same error message every time I try to install.Anyone familiar with this issue or know how to fix this. Thanks in advance! Problem 1 - Installation request for phpunit/phpunit 4.6.*@dev -> satisfiable by phpunit/phpunit[4.6.x-dev]. - phpunit/phpunit 4.6.x-dev requires phpunit/php-code-coverage ~3.0 -> no matching package found.Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability se...Read more

wamp - Can't install PHPUnit with PEAR 1.9.1

This appears to be an issue known with earlier versions of PEAR, unfortunately the solutions did not work for me.My setup: Win7, 32bit. PHP directory: c:\Program Files\PHP.All commands are run from a console with admin rights.I have installed the latest (on 2012.02.17) version of PEAR available. Using the go-pear.phar it came as 1.9.1. Then I tried to install PHPUnit by running pear install and got the following errors: phpunit/PHPUnit requires PEAR Installer (version >= 1.9.4), installed version is 1.9.1phpunit/PH...Read more

composer php - how do I remove phpunit from pear correctly

So I have a problem, because at the moment I have phpunit in a 3.7 version installled through pear. Now, I wanted to upgrade this, but in the documentation they recommend installing it globally through composer. I've done this, it installs the current newest version(5.3) but if i type phpunuit -version it says that I have installed a version 3.7. Now, I can't somehow remove this package from pear, it says that phpunit can not be found, although I can see the phpunit files in the pear directory. If I do pear list, phpunit doesn't show up, so I'm...Read more

pear - How do I install PHPUnit 3.5, instead of 3.6?

The current version of PHPUnit is 3.6, but until I update my code I need to use 3.5.15 instead. I'm having a lot of trouble trying to get 3.5.15 installed.I start with a clean install of Zend Server, which only has a few basic PEAR packages installed. I channel-discover and Then I try installing 3.5.15 from a URL, but it fails:# pear install PHPUnit-3.5.15.tgz ...Duplicate package channel:// foundDuplicate package cha...Read more

pear - Connect failed when installed PHPUnit

I had a problem when installed PHPUnit, i couldn't open a connection when used pear channel-discover (website is normal and i still use channel-info or clear-cache normally). I tried many ways but failed.I hope a help from you,Thank everyone very much,Command line: pear channel-discover pear.phpunit.deError: ...Connection to '' failed: A connection attempt...because connected host has failed to respond...Read more

fatal error - phpUnit - File/Iterator/Autoload.php failed opening

I am trying to get phpUnit running on a centos running plesk pannel.I have installed phpunit successfully.Package Version StateFile_Iterator 1.3.1 stablePHPUnit 3.6.10 stablePHPUnit_MockObject 1.1.1 stablePHP_CodeCoverage 1.1.2 stablePHP_Invoker 1.1.0 stablePHP_Timer 1.0.2 stablePHP_TokenStream 1.1.3 stableText_Template 1.1.1 stablehowever whenever i run the phpunit command from the shell i get the following error: PHP Warning: require_once(File/Iterator/Autoload.php): failed...Read more

pear - phpunit seems to load incorrect include path

I'm trying to get an installation of phpunit going on my os x Lion with MAMP. I have installed phpunit at /Applications/MAMP/bin/php/php5.4.4/lib/php.When I run phpunit in the terminal I get this error: Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /usr/lib/php/pear/PHPUnit/Autoload.php on line 45 Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:') in /usr/lib/php/pear/PHPUnit/Autoload.php on line 45I noticed that the include path is ...Read more

PHPUnit not returning to next test case

I have two test cases, one returns a value, the next is supposed to use the return value.class GenerateAckFeedTest extends PHPUnit_Framework_TestCase{ public function testThankyouAckFeedErrors() { $ackFeed = array(1,2,3); return $ackFeed; } /*** * @depends testCitiThankyouAckFeedErrors */ public function testCitiThankyouAckFeedGeneration(array $ackFeed) { }}The error I get is:There was 1 error:1) testCitiThankyouAckFeedGeneration(GenerateAckFeedTest)Exception: ERRNO: 4096 TEXT: Argument 1 passed to Ge...Read more