I am using the PHPUnit Selenium Extension for Selenium RC.
I am able to assert the field is present:
$this->assertElementPresent('Date');
But how do I assert that the field is disabled (or not editable)?
...
I have button on the page that being used as a link to another page. So when the user clicks the button they are redirected to the right page.
I am using the Selenium extension for PHPUnit and I would like to test that the button is correctly redirecting the user. Here is the HTML that I am trying to test:
<button onclick="window.locat...
I'm testing some legacy code that extends the default php exception object. This code prints out a custom HTML error message.
I would like to mock this exception object in such a way that when the tested code generates an exception it will just echo the basic message instead of giving me the whole HTML message.
I cannot figure out a w...
i have a problem in crateing the PHPUnit tests.
where the framework i am using is codeignaitor in addition to doctorin for the ORM
the error it i got is
cannt find class controller
...
Hi everyone,
I have recently heard a lot of people argue about using PHP testing features like PHPunit and SimpleTest together with their IDE of choice (Eclipse for me). After googling the subject, I have still a hard time understanding the pros and cons of using these testing frameworks to speed up development.
If anyone could explain...
I am looking to migrate my selenium RC tests to using PHPUnit 3.4.12 from PHPUnit 3.3.2
The selenium test will fail with an exception of the following when I use assertTextPresent()
PHPUnit_Framework_Exception: Response from Selenium RC server for getLocation().
ERROR Server Exception: sessionId should not be null; has this session be...
I am using PHPUnit 3.4.12 to drive my selenium tests. I'd like to be able to get a screenshot taken automatically when a test fails. This should be supported as explained at http://www.phpunit.de/manual/current/en/selenium.html#selenium.seleniumtestcase.examples.WebTest2.php
class WebTest
{
protected $captureScreenshotOnFailure = t...
I am testing authentification functionality of my site. Zend_Auth is using as authorization engine. But auth status remains between tests and I need to write 'logout' in every tearDown.
Now everything is all right. But the problem is following. As for I know Zend_Auth uses Zend_Session for storing auth data. So, session is common for al...
I want to use Maven for PHP with PHPUnit but when I run my tests with "mvn test" I get this error: http://pastie.org/948377
This happens only when I use a version newer than 3.3.9 for PHPUnit. The tests work just fine with PHPUnit 3.3.9.
Any idea?
...
public function getAvailableVideosByRfid($rfid, $count=200) {
$query="SELECT id FROM sometable WHERE rfid='$rfid'";
$result = mysql_query($query);
$count2 = mysql_num_rows($result);
if ($count2){ //this rfid has been claimed
return 0;
}
My assertions are :
1). $rfid is a string 5 characters long
2). I am getting a valid result ...
I am trying to get into the habit of writing a unit test before the actual class. What are some pointers the stack overflow community can give me along with any useful resources.
Thank You
...
Hi,
i have studied some examples for PHPUnit with Zend Framework, but there is one part iam not understanding.
In the most examples, the Application Bootstrap runs from some kind of baseClass inside
the setUp() Method.
Why not in __construct()? Is there any good reason?
Example iam talking about
...
I have a form text field that is being populated with a default value. I would like to clear the value and enter white space to assert that the expected validation occurs. I am using Selenium RC and the PHPUnit Selenium extension. How can I achieve this?
Note: I have already tried doing these, but they do not work:
$this->type('FirstNa...
I have a MySQL file that represents my database in a specific state that would allow me to test a class I am working on. What I want to do is have PHPUnit clean and rebuild the database from this file for each test or set of tests.
How can I go about that without having to resort to rewriting the data in the XML format that PHPUnit uses...
I have a class that uses a lot of database internally, so I built the constructor with a $db handle that I am supposed to pass to it.
I am just getting started with PHPUnit, and I am not sure how I should go ahead and pass the database handle through setup.
// Test code
public function setUp(/*do I pass a database handle through here,...
Some of the testing I will need to do will require comparing a known array with the result I am getting from the functions I will be running.
For comparing arrays recursively:
Does PHPUnit have an inbuilt function?
Does someone here have some code they have constructed to share?
Will this be something I will have to construct on my ...
I am new into PHPUnit, and just digging through the manual. I cannot find a decent example of how to build a complete test from end to end though, and so, am left with questions.
One of these is how can I prep my environment to properly test my code?
I am trying to figure out how to properly pass various configuration values needed for...
I have a button (outside of a form) that redirects to another page using the onclick attribute that calls window.location to redirect the user to another page. This time I can't change the HTML. I am using Safari 4 for testing. How can I click a button that uses the onclick attribute and window.location to redirect using Safari 4 and Sel...
I have some buttons with an onclick attribute and some that don't. I want to check if the specified element has the onclick attribute. How can I do this?
getAttribute() returns the attribute value when it has one. When it doesn't, it throws a RuntimeException and stops the test (even when I wrap it in a try/catch block).
$onclickValue ...
I have a class and few functions that I need to test against multiple sets of data. I load these data from flat files. I understand that I can load a file in the setUp() method and run my tests, but how do I load multiple sets of data and test the same functions against those data?
...