MINOR Added test for the inverse for DataObjectDecoratorTest::testOneToManyAssociationWithDecorator()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@80352 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-06-29 05:14:06 +00:00
parent 628a0b7b88
commit 14e77970c8

View File

@ -20,10 +20,17 @@ class DataObjectDecoratorTest extends SapphireTest {
$contact->write();
$object->ContactID = $contact->ID;
$object->write();
$contactID = $contact->ID;
unset($contact);
unset($object);
$contact = DataObject::get_one("DataObjectDecoratorTest_Member", "\"Website\"='http://www.example.com'");
$object = DataObject::get_one('DataObjectDecoratorTest_RelatedObject', "\"ContactID\" = {$contactID}");
$this->assertNotNull($object, 'Related object not null');
$this->assertType('DataObjectDecoratorTest_Member', $object->Contact(), 'Related contact is a member dataobject');
$this->assertType('DataObjectDecoratorTest_Member', $object->getComponent('Contact'), 'getComponent does the same thing as Contact()');
$this->assertType('DataObjectDecoratorTest_RelatedObject', $contact->RelatedObjects()->First());
$this->assertEquals("Lorem ipsum dolor", $contact->RelatedObjects()->First()->FieldOne);