silverstripe / .github

0 stars 2 forks source link

Make use of useDatabase annotation #330

Open emteknetnz opened 3 days ago

emteknetnz commented 3 days ago

SapphireTest can utilize a @useDatabase false annotation to not reset the database when there's a unit test method inside of test class that does use the database, either because $usesDatabase = true, or because a yml fixture file is being used. This saves a little running time.

Acceptance criteria

GuySartorelli commented 3 days ago

You can also set protected $usesDatabase = false; in a class to explicitly not use database for any tests in that class, which is probably preferable to annotating all the methods in that class.