Hi fellow stackers,
I'm trying some supposedly nice features of PHPUnit, but I cannot generate a freakin' code coverage report. What I get is:
rolf@dev ~/projects/current/tests $ scripts/phpunit --configuration $PROJECTS/current/tests/conf/inc/tests.xml
[...]
Generating code coverage report, this may take a moment.
[...]
Fatal error: ...
I'm having difficulty mocking the PDO object with PHPUnit.
There doesn't seem to be much information on the web about my problem but from what I can gather:
PDO has 'final' __wakeup and
__sleep methods that prevent it from being serialised.
PHPunit's mock object implementation serialises the object at some point.
The unit tests then...
Hi all,
I installed xdebug on my Apache and if I define a breakpoint in Netbeans, the execution breaks fine. But if I execute the tests with symfony phpunit:test-all, the execution will not break on the given break point.
Any ideas?
cowabunga!
...
The coverage information is created by xdebug but instead of the inclusion into the coverage report, it creates a file with the information for every test in the webroot of the application.
I use the following setup:
class SeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
public function __construct($name,array $data = a...
Requirements:
Netbeans with PHPUnit(6.9)
How to:
Exclude lines in code coverage.
Exclude code blocks(lines) in code covarage.
...
So, I've got a little problem with my Unittests. I wrote some basisclasses for different Testcases and I want to uses some prepared test-methods.
i.e.
class ModelTestCase extends PHPUnit_Framework_TestCase {
public function testCreateInstance() { ... }
}
class UserModelTest extends ModelTestCase {
/**
* (at)depends testCreateIn...
1) "glob:at row [0-9]" does not match "at row 7"
2) "glob:at row *" does match "at row 7"
Why does "glob:at row [0-9]" not match "at row 7"? How do I fix it?
...
EDIT 3: Solved. See below.
EDIT 2: I think Chadwick's on the right track with his comment. Hudson/PHPUnit is taking the localhost (the Hudson workspace) AND my local file structure and using both to run the unit tests. So it's redeclaring everything that was already declared. Why is this happening and how can I change it?
I've since re...
I'm trying to write a unit test for a controller using Zend and PHPUnit
In the code I get data from php://input
$req = new Zend_Controller_Request_Http();
$data = $req->getRawBody();
My code works fine when I test the real application, but unless I can supply data as a raw http post, $data will always be blank. The getRawBody() meth...
Is it possible to create a mock for the function?
UPD1:
$class->callback('callback_function');
I've tried to test whether callback_function was invoked once or not.
...
I'm trying to create a mock object of \SplObserver using PHPunit and attach the mocked object to an \SplSubject. When I try to attach the mocked object to a class that implements \SplSubject, I get a catchable fatal error saying that the mocked object doesn't implement \SplObserver:
PHP Catchable fatal error: Argument 1 passed to ..\A...
Let's just skip right to the good stuff...
errors I'm getting from the console when running Ant:
phpunit:
[exec] PHPUnit 3.2.16 by Sebastian Bergmann.
[exec]
[exec] Class /var/lib/hudson/jobs/Goals/workspace/Goals/AllTests could not be found in /var/lib/hudson/jobs/Goals/workspace/Goals/AllTests.php.
[exec] Result:...
I'm trying to write some tests with PHPUnit for our various classes/methods/functions. Some of these require database connectivity. Obviously, I'd like to Mock these, so that I don't change our database(s).
Can someone point me to some code that explains how to do this? I see lots of examples of Mocking, but nothing specifically abou...
I am running tests from phpunit using selenium. Since the tests take a couple of minutes proceed, I would like to switch to another desktop and do some tasks while the tests are running in the background.
However, since every test calls a new browser via selenium remote server, and a new test management window and a application window ...
Ok, so here's the issue I've run into. On some of our production systems, we have magic quotes gpc enabled. There's nothing I can do about that. So, I've built my request data handing classes to compensate:
protected static function clean($var)
{
if (get_magic_quotes_gpc()) {
if (is_array($var)) {
foreach ($v...
Selenium, php, phpUnit, 404 error calls testComplete() rather than continue, how do I stop this?
I am using selenium server and phpUnit to run php based tests. My tests are simple, test the page is there, if it loads, has no errors on page and then move on. I have a missing page and rather than say, yep its not there and more on I get:
...
Hi,
I would like to test a method from an abstract class. In this class is there a abstract method with is static.
I use PHPUnit. With normal abstract methods it works:
<?php
abstract class AbstractClass
{
public function concreteMethod()
{
return $this->abstractMethod();
}
public abstract function abstractMethod();
}
cl...
Basically, I want to run selenium tests that allow the database to be setup to a define status before each Selenium test. How would I do this?
...
Sometimes in my code, I'll check to see if a particular object implements an interface:
if ($instance instanceof Interface) {};
However, creating mocks of said interface in PHPUnit, I can't seem to pass that test.
// class name is Mock_Interface_431469d7, does not pass above check
$instance = $this->getMock('Interface');
I under...
Hi,
i am trying to execute all tests in subfolders of my test directory. This works locally on my computer but not on the integration server.
phpunit does not find the test files
hudson@slipstream:~/.hudson/jobs/stendhal_website/workspace$ phpunit tests
PHPUnit 3.4.5 by Sebastian Bergmann.
Time: 0 seconds, Memory: 4.50Mb
OK (0 tests, ...