Ok, I'm tired of searching and trying to debug things so I'll ask here: can someone provide me with a Simpletest version that runs on php 5.2.5?
I downloaded the last release, I checked out from svn on sourceforge but can't get anything running properly.
Simpletest download
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Simpletest download
The code in subversion is E_STRICT:
The latest download on sourceforge works with PHP5, but not under E_STRICT.
Code: Select all
svn co https://simpletest.svn.sourceforge.net/ ... test/trunk simpletestRe: Simpletest download
I have checked out exactly that version. But there is so much changed, I can't get it working. The accompanying HELP_MY_TESTS_DONT_WORK_ANYMORE help file is also very confusing, the info in it doesn't make sense with what's in the checkout.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Simpletest download
Don't read that file
That only really applies to experience SimpleTest users who my have used way older versions.
Once you've checked out the code, create a file called "test.php" somewhere in your web root. Inside it, put these contents:
test.php
What do you get if you run that in your web browser?
Once you've checked out the code, create a file called "test.php" somewhere in your web root. Inside it, put these contents:
test.php
Code: Select all
<?php
require_once '/path/to/simpletest/unit_tester.php';
require_once '/path/to/simpletest/reporter.php';
class MyTest extends UnitTestCase {
public function testNothing() {
$this->assertFalse(true, 'Just a failing nothing test');
}
}
$test = new MyTest();
$test->run(new HtmlReporter());
Re: Simpletest download
Brilliant! That runs fine. Thanks. So now I know at least that it does work.
The problem then is to convert my existing test setup to run. It's the test setup Arborint made for the Skeleton
Running this will lead to
Fatal error: Class 'GroupTest' not found in /Users/matthijs/Sites/skeleton/tests/all_tests.php on line 16
From this situation, starting to follow the instructions in the help file only leads to more errors:
Replacing the line
$test = &new GroupTest($title);
with
$test = &new TestSuite($title);
leads to
Fatal error: Call to undefined method TestSuite::addTestFile() in /Users/matthijs/Sites/skeleton/tests/all_tests.php on line 22
There's nothing in the help file about this error.
In the mean time I did get the old version (the download) to work, so maybe I should just use that. But it's too bad it doesn't run E-strict, something I would like.
The problem then is to convert my existing test setup to run. It's the test setup Arborint made for the Skeleton
Code: Select all
<?php
ini_set('error_reporting', E_ALL | E_STRICT);
require_once('config.php');
require_once(SIMPLETESTDIR . 'simpletest.php');
require_once(SIMPLETESTDIR . 'unit_tester.php');
require_once(SIMPLETESTDIR . 'reporter.php');
if (isset($_GET['test']) && file_exists($_GET['test'])) {
$testfile = $_GET['test'];
$title = "Test File $testfile";
} else {
$testfile = '';
$title = 'All Test Files';
}
$test = &new GroupTest($title);
if ($testfile) {
$test->addTestFile($_GET['test']);
} else {
foreach(glob(dirname(__FILE__) . '/*_test.php') as $testfile) {
$test->addTestFile($testfile);
}
}
if (TextReporter::inCli()) {
$test->run(new TextReporter());
} else {
$test->run(new HtmlReporter());
}
Fatal error: Class 'GroupTest' not found in /Users/matthijs/Sites/skeleton/tests/all_tests.php on line 16
From this situation, starting to follow the instructions in the help file only leads to more errors:
Replacing the line
$test = &new GroupTest($title);
with
$test = &new TestSuite($title);
leads to
Fatal error: Call to undefined method TestSuite::addTestFile() in /Users/matthijs/Sites/skeleton/tests/all_tests.php on line 22
There's nothing in the help file about this error.
In the mean time I did get the old version (the download) to work, so maybe I should just use that. But it's too bad it doesn't run E-strict, something I would like.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Simpletest download
I stopped using GroupTest and TestSuite because of memory issues and because it's easier to have a fresh test environment for each test if you run each test indivudually. My custom built suite is a little complex however but I plan on tidying it up and releasing it.
You want $suite->addFile(...) as opposed to addTestFile( ... ).
You want $suite->addFile(...) as opposed to addTestFile( ... ).
Re: Simpletest download
Ok, nice to know. Thanks for your reply. As Arborint put it together is nice because if a testfile is selected it runs that single test, otherwise it will run all tests. But I can imagine that if your tests gets larger you'd wan to run them individually.