I have a test class that should run migrations in all namespaces:
namespace Tests\App\Libraries;
use App\Libraries\InvoicesLib;
use App\Models\InvoicesModel;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\DatabaseTestTrait;
use Tests\Support\Database\Seeds\ClientsSeeder;
use Tests\Support\Database\Seeds\IncomeTypesSeeder;
use Tests\Support\Database\Seeds\InvoicesSeeder;
use Tests\Support\Database\Seeds\ServiceTypesSeeder;
use Tests\Support\Database\Seeds\SettingsSeeder;
/**
* @internal
*/
final class InvoicesLibTest extends CIUnitTestCase
{
use DatabaseTestTrait;
protected $DBGroup = 'tests';
// For Migrations
protected $migrate = true;
protected $migrateOnce = false;
protected $refresh = true;
protected $namespace; // = from all namespaces
All migrations are run except for IonAuth. Therefore I see errors like:
dg@tvenkinys:~/Programavimas/saskaitos$ vendor/bin/phpunit --filter InvoicesLib
PHPUnit 9.6.20 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.6
Configuration: /home/dg/Programavimas/saskaitos/phpunit.xml
Warning: XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set
EEEEEEEEE 9 / 9 (100%)
Time: 00:06.765, Memory: 14.00 MB
There were 9 errors:
1) Tests\App\Libraries\InvoicesLibTest::testCalculateInvoiceNumber
CodeIgniter\Database\Exceptions\DatabaseException: SQLite3::exec(): no such table: main.users
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Database/BaseConnection.php:647
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Database/BaseBuilder.php:2307
/home/dg/Programavimas/saskaitos/tests/_support/Database/Seeds/ClientsSeeder.php:81
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Database/Seeder.php:145
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Test/DatabaseTestTrait.php:223
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Test/DatabaseTestTrait.php:209
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Test/DatabaseTestTrait.php:190
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Test/DatabaseTestTrait.php:58
/home/dg/Programavimas/saskaitos/vendor/codeigniter4/framework/system/Test/CIUnitTestCase.php:249
/home/dg/Programavimas/saskaitos/tests/app/Libraries/InvoicesLibTest.php:46
Caused by
CodeIgniter\Database\Exceptions\DatabaseException: SQLite3::exec(): no such table: main.users
What could be the cause of it?
also, when I run in an empty project
The ionAuth migration is omitted, while other non App namespace migrations are included (I use only one, Settings).
I have to run
php spark migrate -n IonAuth
to get it to execute.
I am doing these tests on Codeigniter 4.4.8. On earlier versions (before 4.4.1, I would presume) this did work.
I have a test class that should run migrations in all namespaces:
All migrations are run except for IonAuth. Therefore I see errors like:
What could be the cause of it?
also, when I run in an empty project
The ionAuth migration is omitted, while other non App namespace migrations are included (I use only one, Settings).
I have to run
to get it to execute.
I am doing these tests on Codeigniter 4.4.8. On earlier versions (before 4.4.1, I would presume) this did work.