mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
fixed inverseof test assertation
fixed wrong test to actually test what it should. current assertation is a duplicate. thanks to @laszlovl for spotting it. pr #8497
This commit is contained in:
@ -927,8 +927,10 @@ abstract class ActiveRecordTest extends DatabaseTestCase
|
|||||||
$customer = Customer::findOne(2);
|
$customer = Customer::findOne(2);
|
||||||
$orders = $customer->getOrders2()->all();
|
$orders = $customer->getOrders2()->all();
|
||||||
$this->assertTrue(count($orders) === 2);
|
$this->assertTrue(count($orders) === 2);
|
||||||
$this->assertTrue($customer->orders2[0]->customer2 === $customer);
|
$this->assertTrue($orders[0]->isRelationPopulated('customer2'), 'inverse relation did not populate the relation');
|
||||||
$this->assertTrue($customer->orders2[1]->customer2 === $customer);
|
$this->assertTrue($orders[1]->isRelationPopulated('customer2'), 'inverse relation did not populate the relation');
|
||||||
|
$this->assertTrue($orders[0]->customer2 === $customer);
|
||||||
|
$this->assertTrue($orders[1]->customer2 === $customer);
|
||||||
|
|
||||||
// the other way around
|
// the other way around
|
||||||
$customer = Customer::find()->with('orders2')->where(['id' => 1])->asArray()->one();
|
$customer = Customer::find()->with('orders2')->where(['id' => 1])->asArray()->one();
|
||||||
|
Reference in New Issue
Block a user