mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Removed deprecated YamlFixture->saveIntoDatabase() usage
This commit is contained in:
parent
4f95a07936
commit
8538cb9ee2
@ -38,23 +38,24 @@ class YamlFixtureTest extends SapphireTest {
|
||||
}
|
||||
|
||||
public function testSQLInsert() {
|
||||
$factory = new FixtureFactory();
|
||||
$relPath = FRAMEWORK_DIR . '/tests/testing/YamlFixtureTest.yml';
|
||||
$fixture = Injector::inst()->create('YamlFixture', $relPath);
|
||||
$fixture->saveIntoDatabase(DataModel::inst());
|
||||
$fixture->writeInto($factory);
|
||||
|
||||
$this->assertGreaterThan(0, $fixture->idFromFixture("YamlFixtureTest_DataObject", "testobject1"));
|
||||
$this->assertGreaterThan(0, $factory->getId("YamlFixtureTest_DataObject", "testobject1"));
|
||||
$object1 = DataObject::get_by_id(
|
||||
"YamlFixtureTest_DataObject",
|
||||
$fixture->idFromFixture("YamlFixtureTest_DataObject", "testobject1")
|
||||
$factory->getId("YamlFixtureTest_DataObject", "testobject1")
|
||||
);
|
||||
$this->assertTrue(
|
||||
$object1->ManyMany()->Count() == 2,
|
||||
"Should be two items in this relationship"
|
||||
);
|
||||
$this->assertGreaterThan(0, $fixture->idFromFixture("YamlFixtureTest_DataObject", "testobject2"));
|
||||
$this->assertGreaterThan(0, $factory->getId("YamlFixtureTest_DataObject", "testobject2"));
|
||||
$object2 = DataObject::get_by_id(
|
||||
"YamlFixtureTest_DataObject",
|
||||
$fixture->idFromFixture("YamlFixtureTest_DataObject", "testobject2")
|
||||
$factory->getId("YamlFixtureTest_DataObject", "testobject2")
|
||||
);
|
||||
$this->assertTrue(
|
||||
$object2->ManyMany()->Count() == 1,
|
||||
|
Loading…
Reference in New Issue
Block a user