simpletest

Where can i find extended HTML reporters for Simpletest?

I am using Simpletest as my unit test framework for the PHP site I am currently working on. I like the fact that it is shipped with a simple HTML reporter, but I would like a bit more advanced reporter. I have read at the reporter api documentation, but it would be nice to be able to use an existing reporter, instead of having to do it ...

Simple test vs PHPunit

I was wondering if anyone that have experience in both these stuff can shed some light on the significant difference between the two, if any? Any specific strength of each that makes it suitable for any specific case? ...

How to (with SimpleTest) write an AssertTags test with regex?

I wish to test a function that will generate lorem ipsum text, but it does so within html tags. So I cant know in advance the textual content, but i know the html structure. That is what I want to test. And maybe that the length of the texts are within certain limits. So what I am wondering is if the assertTags can do this in a way parap...

How do you set up database testing using the PHP SimpleTest framework

I am using SimpleTest, a PHP-based unit testing framework. I am testing new code that will handle storing and retrieving website comments from a database. I am at a loss for how to structure the project to test the database access code. I am looking for any suggestions as to best practices for testing db code in a PHP application. Examp...

which unit-test framework for PHP: simpletest, phpunit or ?

I'm a big fan of simpletest because it's what I know. It has excellent support for mocking and web-testing. But I'm always scared of stagnating so any compelling arguments to switch would be appreciated. ...

Missing Table with Simpletest in CakePHP

I'm using cakePHP and am using Simpletest as the testing suite. Whenever I run tests on the models, I get an error: Missing Database Table Error: Database table account_types for model AccountType was not found." (For whatever) Does anyone know how to fix this problem? My guess is the fixtures are not being created or something alo...

Unit testing Zend controllers - how do I test what has been set in the view

In Zend, models are added to the view: //In a controller public function indexAction() { //Do some work and get a model $this->view->model = $model; } We can easily check that "model" exists in the view (I'm using simpletest for this): //In a unit test public function testModelIsSetInView() { //Call the controllers inde...

Count pattern in simpletest (PHP test framework)

Hi How can I test if there is a string only once in a site? I use the WebTestCase from simpletest. ...

How can you set-up PHP + xDebug + (x)Unit + Eclipse to work with breakpoints in unit tests?

Hi guys, Have tried for quite some time to get this to work correctly but to no luck. Basically, I have Eclipse (3.3) with PHP Development Tools (PDT), and the PDT XDebug plugin as well as the SimpleTest eclipse plugin. What I want to do is debug code invoked by SimpleTest unit tests. SimpleTest clearly can see XDebug, because I can ge...

How do I write unit tests in PHP with a procedural codebase?

I'm mostly convinced of the benefits of unit testing, and I would like to start applying the concept to a large existing codebase written in PHP. Less than 10% of this code is object-oriented. I've looked at several unit testing frameworks (PHPUnit, SimpleTest, and phpt). However, I haven't found examples for any of these that test pr...

SimpleTest Mocking Problem

I'm writing some test cases, and I've got a test case that is using Mock objects. I need to check to see if two class methods are called from another class method. Here's what I've done: First I generated the Mock: Mock::generate('Parser'); Then, inside my test I called: $P = new MockParser(); $P->expectOnce('loadUrl', array('http:...

cakephp - Creating fixtures, how to handle foreign keys?

Hey all - I'm trying to create some fixture data for my unit tests in CakePHP (via SimpleTest) and I have no idea how to handle my foreign key relationships. Here's a sample of the fixture code: <?php class SpecialtyFixture extends CakeTestFixture { var $name = "Specialty"; var $import = "Specialty"; var $records = array( ...

Equivalent of SimpleTest "partial mocks" in PHPUnit?

I'm trying to migrate a bunch of tests from SimpleTest to PHPUnit and I was wondering if there is an equivalent for SimpleTest's partial mocks. Update: I can't seem to find anything in the docs which suggests that this feature is available, but it occurred to me that I could just use a subclass. Is this a good or bad idea? class StuffD...

Mocking PHP functions in unit tests

I'm unit-testing some PHP code with SimpleTest and I've run into trouble. In my tests of a database class I want to be able to set an expectation for PHPs mysql functions. In my tests of a wrapper class for the mail function I want to mock PHPs mail function. These are just some examples. The point is: I don't (always) want to test if m...

Real-world testing of CakePHP controllers?

I'm writing a new application with CakePHP (just-released 1.2.4), using SimpleTest 1.0.1. I have read the relevant sections of the Cookbook, searched on the Bakery, and read Mark Story's postings on controller testing (the hard way and with mocks). Unfortunately, none of this talks about real-world testing of non-trivial controllers. Lo...

cakephp simpletest webtester delay/sleep function

hi, I am using simpletest to do integration testing of my websites, and I need to tell the internal browser to wait for a certain amount of time (as the page is being redirected), and then do assertText. Is there an easy way to do this ? Regards ...

Drupal's SimpleTest not creating copies of custom tables

I am using the SimpleTest module version 6.x-2.8 with Drupal 6.13. I wrote a custom module, for which I wrote some tests. However, SimpleTest doesn't seem to be creating a copy of the table associated with my custom module, because I get an exception message for every time I try to insert something into the table or query it in the Simpl...

Simpletest TestFixture

Hi, We are using Simpletest to do some integration testing on my website. Question: How can we use the TestFixtures to test my controller code? Basically we want to control the initial state of the Model by using the TestFixtures and populating the $fields and $records, and then use WebTest functionality to test on the supplied record...

is there a way to trigger an IE window to open from firefox browser using php and javascript?

i am using simpletest as my php unit test framework. i put all my test cases into a single all_tests.php file however, because of the tendency of our developers to use firefox to run the all_tests.php, we tend to miss out on fail cases that are browser specific, especially ie7. is there a way that when somebody browse our all_tests.ph...

Unit Testing With SimpleTest in PHP keeping getting file directory errors from relative paths?

I am using Zend Framework MVC and unit-testing with SimpleTest library. I have a specific model that keeps failing because it uses Zend Cache and the cache directory is a relative path I was wondering if anyone has seen a problem like this b4. Thanks. ...