API Update API to reflect changes to CLI interaction (#93)

This commit is contained in:
Guy Sartorelli 2024-09-26 17:17:06 +12:00 committed by GitHub
parent a8efc75702
commit 3eb61e353f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,9 +15,10 @@ use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\FixtureFactory; use SilverStripe\Dev\FixtureFactory;
use SilverStripe\PolyExecution\Command\DbBuild;
use SilverStripe\PolyExecution\PolyOutput;
use SilverStripe\Dev\YamlFixture; use SilverStripe\Dev\YamlFixture;
use SilverStripe\ORM\Connect\TempDatabase; use SilverStripe\ORM\Connect\TempDatabase;
use SilverStripe\ORM\DatabaseAdmin;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
@ -370,9 +371,13 @@ class TestSessionEnvironment
} }
// In case the dump involved CREATE TABLE commands, we need to ensure the schema is still up to date // In case the dump involved CREATE TABLE commands, we need to ensure the schema is still up to date
$dbAdmin = new DatabaseAdmin(); $dbBuild = new DbBuild();
Versioned::set_reading_mode(''); Versioned::set_reading_mode('');
$dbAdmin->doBuild(true, $requireDefaultRecords); $output = new PolyOutput(
Director::is_cli() ? PolyOutput::FORMAT_ANSI : PolyOutput::FORMAT_HTML,
PolyOutput::VERBOSITY_QUIET
);
$dbBuild->doBuild($output, $requireDefaultRecords);
} }
/** /**
@ -380,9 +385,13 @@ class TestSessionEnvironment
*/ */
public function requireDefaultRecords() public function requireDefaultRecords()
{ {
$dbAdmin = new DatabaseAdmin(); $dbBuild = new DbBuild();
Versioned::set_reading_mode(''); Versioned::set_reading_mode('');
$dbAdmin->doBuild(true, true); $output = new PolyOutput(
Director::is_cli() ? PolyOutput::FORMAT_ANSI : PolyOutput::FORMAT_HTML,
PolyOutput::VERBOSITY_QUIET
);
$dbBuild->doBuild($output, true);
} }
/** /**