Questions tagged [simpletest]

Simpletest is a Unit and Web Testing framework developed in PHP.

Simpletest is a Unit and Web Testing framework developed in PHP. You can read more about it and how to set it up at http://simpletest.org/.

Other links:

167 questions
127
votes
12 answers

SimpleTest vs PHPunit

I was wondering if anyone that has experience in both this 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?
paan
  • 6,868
  • 7
  • 33
  • 41
33
votes
4 answers

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…
Shabbyrobe
  • 11,310
  • 15
  • 55
  • 86
30
votes
3 answers

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…
Travis Beale
  • 4,996
  • 7
  • 31
  • 34
18
votes
3 answers

How to catch an "undefined index" E_NOTICE error in simpleTest?

I would like to write a test using simpleTest that would fail if the method I'm testing results in a PHP E_NOTICE "undefined index : foo". I tried expectError() and expectException() without success. The simpleTest webpage indicate that simpleTest…
pixelastic
  • 4,678
  • 6
  • 21
  • 28
16
votes
4 answers

How can I write tests for file upload in PHP?

I'm using simpleTest to write my PHP tests. I'm writing a file upload plugin and was wondering how I may be testing it. I would like to check that the file is correctly uploaded, in the right folder, that error are correctly returned when needed,…
pixelastic
  • 4,678
  • 6
  • 21
  • 28
14
votes
5 answers

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.
Ken
  • 71,088
  • 29
  • 81
  • 100
13
votes
2 answers

PHP Unit testing

Is there any EASY php testing Framework and may be simpler than simpletest and not command line based like PHPUnit ?
AlSayed Gamal
  • 139
  • 1
  • 2
  • 4
13
votes
4 answers

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…
avdgaag
  • 38,646
  • 7
  • 27
  • 26
12
votes
3 answers

PHP Unit Tests: Is it possible to test for a Fatal Error?

FWIW I'm using SimpleTest 1.1alpha. I have a singleton class, and I want to write a unit test that guarantees that the class is a singleton by attempting to instantiate the class (it has a private constructor). This obviously causes a Fatal…
Stephen
  • 18,089
  • 8
  • 57
  • 97
8
votes
4 answers

PHP Overloading to Unit Test Private Properties and Methods

I've been reading here a few questions regarding the use of unit testing to test private methods and properties. I'm new to unit testing and would like input on the method I'm trying so that my testing can access private/protected properties and…
Chuck
  • 4,166
  • 1
  • 22
  • 45
8
votes
5 answers

What unit testing in PHP to start

Possible Duplicate: Simple test vs PHPunit I'm new to good practices on software development. I need to know with witch testing unit framework should I use. I have see that some people use PHPUnit and others use SimpleTest. What package should I…
André
  • 21,421
  • 41
  • 110
  • 172
7
votes
4 answers

SimpleTest: How to assert that a PHP error is thrown?

If I am correct, SimpleTest will allow you to assert a PHP error is thrown. However, I can't figure out how to use it, based on the documentation. I want to assert that the object I pass into my constructor is an instance of MyOtherObject class…
Andrew
  • 196,883
  • 184
  • 487
  • 673
6
votes
2 answers

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

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…
spronkey
  • 392
  • 2
  • 10
6
votes
1 answer

CakePHP and SimpleTest failing tests from clean install

I've just downloaded Cake PHP 1.3, and installed SimpleTest 1.0.1 into the vendors directory. When I run cake testsuite core all I get the following error: Running core all PHP Fatal error: Cannot redeclare class Article in…
Josh Sherick
  • 2,081
  • 3
  • 20
  • 35
6
votes
2 answers

Cakephp testing login

I want to test login function if it works propperly and only lets valid and active users in. My user fixture contains: array( 'password' => '*emptyPasswordHash*', // empty password 'username' => 'Lorem', 'balance' => 0, …
Elwhis
  • 1,231
  • 2
  • 22
  • 44
1
2 3
11 12