mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-27 21:15:40 +02:00
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65555 467b73ca-7a2a-4603-9d3b-597d59a354a9
31 lines
1.0 KiB
PHP
31 lines
1.0 KiB
PHP
<?php
|
|
|
|
class YamlFixtureTest extends SapphireTest {
|
|
static $fixture_file = 'sapphire/tests/testing/YamlFixtureTest.yml';
|
|
|
|
function testSQLInsert() {
|
|
$object1 = DataObject::get_by_id("YamlFixtureTest_DataObject", $this->idFromFixture("YamlFixtureTest_DataObject", "testobject1"));
|
|
$this->assertTrue($object1->ManyMany()->Count() == 2, "Should be 2 items in this manymany relationship");
|
|
$object2 = DataObject::get_by_id("YamlFixtureTest_DataObject", $this->idFromFixture("YamlFixtureTest_DataObject", "testobject2"));
|
|
$this->assertTrue($object2->ManyMany()->Count() == 2, "Should be 2 items in this manymany relationship");
|
|
}
|
|
}
|
|
|
|
class YamlFixtureTest_DataObject extends DataObject {
|
|
static $db = array(
|
|
"Name" => "Varchar"
|
|
);
|
|
static $many_many = array(
|
|
"ManyMany" => "YamlFixtureTest_DataObjectRelation"
|
|
);
|
|
}
|
|
|
|
class YamlFixtureTest_DataObjectRelation extends DataObject {
|
|
static $db = array(
|
|
"Name" => "Varchar"
|
|
);
|
|
static $belongs_many_many = array(
|
|
"TestParent" => "YamlFixtureTest_DataObject"
|
|
);
|
|
}
|