Removed deprecated YamlFixture->saveIntoDatabase() usage

This commit is contained in:
Ingo Schommer 2013-03-19 12:57:48 +01:00
parent 4f95a07936
commit 8538cb9ee2

View File

@ -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,