Tag Archives: PHPUnit
Assert that a function gets called
When testing with phpunit, I want to assert a function call:
Given a Class:
Class TimeWrapper {
public function time() {
return time();
}
}
And Its unittest:
Class TimeWrapperTest extends PHPUnit_FrameworkTestCase {
public function testTime() {
//Pseudocode as example …
phpunit testing with ajax and zend framework
i have a problem with writing tests for my action that gets called by jquery via ajax. i don’t know how to catch the data that is being sent back to the view, by the action, so that i could… Continua a leggere
IF + PHPUnit: How to assert existence of html elements within ajax response?
Should I extend the ControllerTestCase and create a custom method to handle this? What is the best way?… Continua a leggere
With PHPUnit, using a Data Provider, the last data set always shows “The test case was unexpectedly terminated”
So I’m using PHPUnit for testing. Trying to use a DataProvider with one of my tests.
/**
* Tests Events_Event->Events_Event()
* @dataProvider provider
*/
public function testEvents_Event($Name, $param, $time) {
//$this->assertInstanceOf("Events_Event", $this->Events_Event->Events_Event("test2", array()));
$this->assertTrue(true);
}
public static function provider()
{
…
PHPUnit undefined function mysql_connect()
When I try to connect to my MySQL database from PHP code all seems to be fine, all queries are executed successfully. Tuttavia, when the code is tested with unit tests in PHPUnit, I get the following fatal PHP error:… Continua a leggere
Netbeans “no tests executed”
I have a php project with unit tests included. I use Netbeans for development and would like to have phpunit intergration in my IDE. If I run phpunit from the commandline, it is working. If I press Alt+F6 to run… Continua a leggere
Failed opening 'SiteTest: Firefox.php' when running Yii Functional Test
Warning: include(): Failed opening 'SiteTest: Firefox.php' for inclusion
... yiiframeworkYiiBase.php on line 418
…
Yii v1.1.10
PHPUnit v3.6.10
PHPUnit_Selenium v 1.2.6
I get this error when trying to run the example on the book “Agile Web Development with Yii 1.1 e Continua a leggere
Using YAML Files as data provider in PHPUnit (CIUnit)
I am writing an application using the PHP CodeIgniter Framework. I am trying to test the application using CI_Unit, by extension PHPUnit. To test a model, I am trying to load a YAML data provider as defined in the PHPUnit… Continua a leggere
Come utilizzare le funzionalità di selenio da Selenium2 classe?
Sto utilizzando PHPUnit e selenio nel mio progetto PHP.
Ho seguito le istruzioni alla: http://www.phpunit.de/manual/3.6/en/selenium.html. Attualmente sono in grado di avviare il server Selenio e ho fatto poche classi di test che si estendono sia PHPUnit_Extensions_Selenium2TestCase o PHPUnit_Extensions_SeleniumTestCase classe.
I’ve been using https://github.com/sebastianbergmann/phpunit-selenium/blob/master/Tests/Selenium2TestCaseTest.php… Continua a leggere
How can I PHPUnit test a Controller_Plugin that uses a Redirector helper to redirect?
I can’t work this out.
$this->_request->setBasePath('http://localhost/');
$this->_request->setModuleKey('admin');
$this->_request->setControllerKey('controller-page');
$this->_request->setActionKey('index');
$this->_sslRedirect->preDispatch($this->_request);
$this->assertRedirectRegex('/https:/');
…
In my controller plugin preDispatch() may or may not do a redirect to SSL. This works in the browser, however I’m not able to write a test for it. Continua a leggere





