Description
I'm noticing that even though I'm setting transaction: true in codeception.yml, database operations made within tests aren't rolled back after the test is done. Here's the test file i'm running. There's no modules or plugins enabled for this test instance.
<?php
namespace tests\integration;
use Codeception\Test\Unit;
use craft\elements\Entry;
use tests\fixtures\LocationFixture;
use tests\fixtures\ProviderFixture;
class GmbModuleTest extends Unit
{
/**
* @var \UnitTester
*/
protected $tester;
public function testCreatedLocationTriggersQueue()
{
$section = \Craft::$app->getSections()->getSectionByHandle('locations');
$location = new Entry();
$location->sectionId = $section->id;
$location->title = 'Some New Location';
$location->typeId = $section->getEntryTypes()[0]->id;
$location->enabled = true;
\Craft::$app->getElements()->saveElement($location);
}
}
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
bootstrap: _bootstrap.php
params:
- tests/.env
modules:
config:
\craft\test\Craft:
configFile: "tests/_craft/config/test.php"
entryUrl: "http://host.docker.internal/index.php"
projectConfig: {
folder: "config/project",
reset: false
}
migrations: []
plugins: []
cleanup: true
transaction: true
dbSetup: { clean: true, setupCraft: true }
# Codeception Test Suite Configuration
#
# Suite for unit or integration tests.
actor: UnitTester
modules:
enabled:
- \craft\test\Craft
- Asserts
- \Helper\Unit
docker-compose exec php ./vendor/bin/codecept run integration
Steps to reproduce
- Write a test in which it creates a new entry.
- See that after the test is done running, the entry still exists within the database.
Additional info
- Craft version: 3.6.7
- PHP version: 7.4.14
- Database driver & version: MySQL 8.0.23
- Plugins & versions:
Description
I'm noticing that even though I'm setting
transaction: trueincodeception.yml, database operations made within tests aren't rolled back after the test is done. Here's the test file i'm running. There's no modules or plugins enabled for this test instance.docker-compose exec php ./vendor/bin/codecept run integrationSteps to reproduce
Additional info