mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3.6' into 4.0
This commit is contained in:
commit
cfe93b7f23
@ -108,6 +108,10 @@ class DataObjectDuplicationTest extends SapphireTest
|
|||||||
$two = DataObject::get_by_id(DataObjectDuplicationTest\Class2::class, $two->ID);
|
$two = DataObject::get_by_id(DataObjectDuplicationTest\Class2::class, $two->ID);
|
||||||
$three = DataObject::get_by_id(DataObjectDuplicationTest\Class3::class, $three->ID);
|
$three = DataObject::get_by_id(DataObjectDuplicationTest\Class3::class, $three->ID);
|
||||||
|
|
||||||
|
$this->assertCount(1, $one->twos());
|
||||||
|
$this->assertCount(1, $one->threes());
|
||||||
|
$this->assertCount(1, $three->ones());
|
||||||
|
|
||||||
//test duplication
|
//test duplication
|
||||||
$oneCopy = $one->duplicate(true, true);
|
$oneCopy = $one->duplicate(true, true);
|
||||||
$twoCopy = $two->duplicate(true, true);
|
$twoCopy = $two->duplicate(true, true);
|
||||||
@ -125,19 +129,19 @@ class DataObjectDuplicationTest extends SapphireTest
|
|||||||
$this->assertEquals($text2, $twoCopy->text);
|
$this->assertEquals($text2, $twoCopy->text);
|
||||||
$this->assertEquals($text3, $threeCopy->text);
|
$this->assertEquals($text3, $threeCopy->text);
|
||||||
|
|
||||||
$this->assertNotEquals(
|
$this->assertCount(
|
||||||
$one->twos()->Count(),
|
0,
|
||||||
$oneCopy->twos()->Count(),
|
$oneCopy->twos(),
|
||||||
"Many-to-one relation not copied (has_many)"
|
"Many-to-one relation not copied (has_many)"
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertCount(
|
||||||
$one->threes()->Count(),
|
2,
|
||||||
$oneCopy->threes()->Count(),
|
$oneCopy->threes(),
|
||||||
"Object has the correct number of relations"
|
"Object has the correct number of relations"
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertCount(
|
||||||
$three->ones()->Count(),
|
2,
|
||||||
$threeCopy->ones()->Count(),
|
$threeCopy->ones(),
|
||||||
"Object has the correct number of relations"
|
"Object has the correct number of relations"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -146,9 +150,9 @@ class DataObjectDuplicationTest extends SapphireTest
|
|||||||
$twoCopy->one()->ID,
|
$twoCopy->one()->ID,
|
||||||
"Match between relation of copy and the original"
|
"Match between relation of copy and the original"
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertCount(
|
||||||
0,
|
0,
|
||||||
$oneCopy->twos()->Count(),
|
$oneCopy->twos(),
|
||||||
"Many-to-one relation not copied (has_many)"
|
"Many-to-one relation not copied (has_many)"
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
|
@ -26,4 +26,6 @@ class Class1 extends DataObject implements TestOnly
|
|||||||
'TestExtra' => 'Varchar'
|
'TestExtra' => 'Varchar'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static $default_sort = '"ID" ASC';
|
||||||
}
|
}
|
||||||
|
@ -16,4 +16,6 @@ class Class2 extends DataObject implements TestOnly
|
|||||||
private static $has_one = array(
|
private static $has_one = array(
|
||||||
'one' => Class1::class
|
'one' => Class1::class
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static $default_sort = '"ID" ASC';
|
||||||
}
|
}
|
||||||
|
@ -16,4 +16,6 @@ class Class3 extends DataObject implements TestOnly
|
|||||||
private static $belongs_many_many = array(
|
private static $belongs_many_many = array(
|
||||||
'ones' => Class1::class
|
'ones' => Class1::class
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static $default_sort = '"ID" ASC';
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,6 @@ class Class4 extends DataObject implements TestOnly
|
|||||||
private static $belongs_many_many = [
|
private static $belongs_many_many = [
|
||||||
'Parents' => Class4::class,
|
'Parents' => Class4::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private static $default_sort = '"ID" ASC';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user