simpletest

Using Eclipse SimpleTest plugin - SimpleTest not working

I'm using Eclipse 3.4.2 and installed the latest plug-in for simpletest using Help>Software Updates... The plugin installed correctly and I was able to set it up in Window>Preferences>SimpleTest. I have filled in the following fields : Php.exe file, php.ini file, and test file Suffix. I was not able to find the simpletest Path (not even...

SimpleTest Mock objects: clearing expectations

The short question: Is there a way to reset a Mock object in SimpleTest, removing all expectations? The longer explanation: I have a class that I'm testing using SimpleTest and am having some problem with the Mock objects it is using. The class is a Logger, and inside the logger are a number of Writer objects (FileWriter, EmailWriter,...

My database doesn't insert immediately

Hi, I am a trying to apply Test Driven Development to producing a web page and am having trouble using my database. I am developing using Cake 1.1, PHP5 and SimpleTest to unit test. My problem is that I have a test that: Inserts a row using a direct SQL statement Tests if that row was inserted (by using a function in my main program....

How to implement SimpleTest in Kohana

Here's the problem, I was assigned task from my bos to learn how to use Kohana and implement simple test in that. We would like to use it as our framework for future projects. Being new to both KohanaPHP and SimpleTest, I can't figure it out how to do even the simplest test of my helpers. I can't even find a single step-by-step tutorial...

PHP Unit testing

Is there any EASY php testing Framework and may be simpler than simpletest and not command line based like PHPUnit ? ...

PHP - Simpletest - Comparing numeric strings

Hi, I'm trying to use simpletest to compare two numeric strings, one from an array and one from an object property. I've printed out the values and they are equal, however, the test always returns false. Can anyone help? Here's the code: $this->assertEqual(strval($this->createdforums[$randomforum]), (strval($forum->getTitle))); pr...

Where to place common library for unit test functions in Cakephp?

Currently several of my unit tests need common functions such as logging in a specific user from the mock objects or making sure that no one is logged in. I currently have those functions in a file which I include via a regular old include statement. That doesn't seem very cakey to me. I also don't want to keep typing the include statem...

Using the simpletest automator in Drupal 6.

I've been trying to learn how to use simpletest, and I found the simpletest automator. I was able to install it and run it, but where is the file with the results of the 'macro' saved? I haven't been able to find it. Also, is there a quick way to duplicate a drupal install in simpletest? I know it starts from a clean install, but I d...

Can PHP SimpleTest framework be configured to fail fast?

I'm new to the PHP SimpleTest framework, and I was surprised to see that a failed assertion doesn't halt the test method. In other words, this causes two failure messages in the test report: function testFoo() { $this->assertTrue(true, 'first: %s'); $this->assertTrue(false, 'second: %s'); $this->assertTrue(false, 'third: %s'...

PHP and SimpleTest - running tearDown() even if there's a fatal exception

A search yields a couple of questions on catching fatal exceptions, but this one is specific to using SimpleTest. (I know that SimpleTest is out of date, but getting PHP-Unit to work on my configuration is another question). I am trying to get the tearDown() method to work even when there is a fatal exception, as I create some test rows...

Screenshot of page, or getting unchanged image

Hi there! I need to get image from page, without reloading it, and without getting it's source. I read about "SimpleTest" scriptable browser, but i don't know can it save site image. Any ideas? Thanks ...

Is it possible to set properties on a Mock Object in Simpletest

I normally use getter and setter methods on my objects and I am fine with testing them as mock objects in SimpleTest by manipulating them with code like: Mock::generate('MyObj'); $MockMyObj->setReturnValue('getPropName', 'value') However, I have recently started to use magic interceptors (__set() __get()) and access properties like so...

simpletest - Why does setReturnValue() seem to change behaviour depending whether test is run in isolation or not

I am using SimpleTest version 1.0.1 for a unit test. I create a new mock object within a test method and on it i do: $MockDbAdaptor->setReturnValue('query',1); Now, when i run this in a standalone unit test my tested object is happy to see 1 returned when query() is called on the mock db adaptor. However, when this exact same test ...

Are there any open source SimpleTest Test Cases that test PHP SPL interfaces

I have quite a few objects in my system that implement the PHP SPL Iterator interface. As I write them I also write tests. I know that writing tests is generally NOT a cut 'n paste job. But, when it comes to testing classes that implement Standard PHP Library interfaces, surely it makes sense to have a few script snippets that can b...

What is SimpleTest?

What is SimpleTest? What does assertTrue($b) do in SimpleTest? Do PHP programmers use SimpleTest often to test their programs? ...

login connection problem using SimpleTest

Hi everyone. I am using SimpleBrowser from SimpleTest (http://www.simpletest.org) to login a webmin (http://www.webmin.com/). This login uses https. I've tried two different ways, both fail. $browser = new SimpleBrowser(); $browser->useCookies(); $browser->useFrames(); //echoes the login page, where it should echo the landing page from...

Why should I be using testing frameworks in PHP?

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...

CodeIgniter and SimpleTest -- How to make my first test?

I'm used to web development using LAMP, PHP5, MySQL plus NetBeans with Xdebug. Now I want to improve my development, by learning how to use (A) proper testing and (B) a framework. So I have set up CodeIgniter, SimpleTest and the easy Xdebug add-in for Firefox. This is great fun because maroonbytes provided me with clear instructions a...

Help me write a PHPUnit Test for the following method

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 ...

How to write unit test before the class code?

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 ...