You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.
Adam Žurek edited this page Jun 18, 2016
·
2 revisions
Working with database (Nette\Database)
Testbench is taking care of database creation and deletion. It can also load SQLs. Now it's up to you. Get Context and do whatever you want to do:
use \Testbench\TNetteDatabase;
publicfunctiontestDatabase()
{
$em = $this->getContext();
//Tester\Assert::...
}
Pretty easy, right?
Database tests can be very expensive and long running. You can mark them as slow:
use \Testbench\TCompiledContainer;
use \Testbench\TNetteDatabase;
publicfunctiontestDatabaseSqls()
{
$this->changeRunLevel(\Testbench::SLOW); //or $this->markTestAsVerySlow();//expensive test
}
It will skip this test if you run it with low runlevel (0 is default). You have to set RUNLEVEL environment variable to run this test: $ RUNLEVEL=10 vendor/bin/run-tests ...