Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

TestFramework errors & questions

Go to End

6 Posts   1587 Views


Community Member, 88 Posts

16 November 2010 at 1:28am

Edited: 16/11/2010 1:33am

Hi, I have tried to run some tests but am stuck with the following error message when trying to run dev/tests/SapphireTest

[User Error] TestRunner::only(): Invalid TestCase 'SapphireTest', cannot find matching class

I've found the required files in the filesystem and tried to move them...what brings up another errormessage, so I switched them back again and wrote this post.

Another issue: When running dev/tests/all I only receive a list of tests, but nothing that indicates a failures or success.

And last thing: when calling /dev/tests/coverage - is this page left blank intentionally?

I'm running this stuff on SS 2.4.3, Ubuntu with PHPUnit 3.4.5 installed. Any hints are welcome :)


Forum Moderator, 1899 Posts

16 November 2010 at 3:14am

Quick check...


... is in your config?


Forum Moderator, 5523 Posts

16 November 2010 at 8:54pm

[User Error] TestRunner::only(): Invalid TestCase 'SapphireTest', cannot find matching class

Sounds like you're trying to run the SapphireTest? That itself is not a test so you have to give it either a test case, module name or all.

running /dev/tests/all should run all the tests and /dev/tests/ should show the list of all the tests. Make sure that page isn't just loading. If it doesn't work in a browser try using sake.

Running the full test suite can take a while on some databases (I'm sitting at ~5 mins for full suite on mysql). One trick we employ is using SQLite3 when running tests which reduces it massively see


Community Member, 88 Posts

18 November 2010 at 4:00am

Edited: 18/11/2010 4:17am

Well, I'm trying this on my development environment. I assume tests work also in 'dev' mode.

Running /dev/tests/all takes about 5 seconds and the output looks like: - absolutely no hints about failures.

All I want is to run CurrencyFieldTest and see what failures occour (if any). So I tried calling /dev/tests/CurrencyFieldTest but the output always remains the same, no matter what I put in /sapphire/tests/forms/CurrencyFieldTest.php:

Sake behaves similarly. It takes only about 1 second and produces no output (except some self-produced notices) when starting it by:
./sapphire/sake /dev/tests/all
./sake /dev/tests/all


Forum Moderator, 5523 Posts

18 November 2010 at 2:24pm

Try checking out your php error log, something could be segfaulting or another possible issue is if you have a loose die lying around in your code or some config files. Seen people if if(!$var) die(); and $var may not exist when running tests. Hopefully you get an error message to start off with.


Community Member, 88 Posts

18 November 2010 at 11:11pm

Ah, found it:

PHP Fatal error:  Couldn't run query: \nCREATE DATABASE `tmpdb5733285` \n\nAccess denied for user 'devel'@'' to database 'tmpdb5733285' in /silverstripe_base/sapphire/core/model/MySQLDatabase.php on line 526, referer:

My Database user had only usage privileges...the super privilege fixed this (adding only create privilege does not help much, due to "check" queries). Increasing memory limit (php.ini) to 256MB was also required, 128MB was not sufficient. Thanks a lot!