mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
628a0b7b88
commit
14e77970c8
@ -21,9 +21,16 @@ class DataObjectDecoratorTest extends SapphireTest {
|
||||
$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);
|
||||
|
Loading…
Reference in New Issue
Block a user