Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Testbench\TNetteDatabase

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;

public function testDatabase()
{
	$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;

public function testDatabaseSqls()
{
	$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 ...

Clone this wiki locally