Browse Source

Added test for indexing by related fields.

tags/2.0.14
Sam Mousa 8 years ago
parent
commit
e0e07c9c1b
No known key found for this signature in database
GPG Key ID: D1E4AE5C866A94EA
  1. 12
      tests/framework/db/ActiveRecordTest.php

12
tests/framework/db/ActiveRecordTest.php

@ -1439,4 +1439,16 @@ abstract class ActiveRecordTest extends DatabaseTestCase
// Make sure that only links were removed, the items were not removed
$this->assertEquals(3, $itemClass::find()->where(['category_id' => 2])->count());
}
/**
* https://github.com/yiisoft/yii2/pull/13891
*/
public function testIndexByAfterLoadingRelations()
{
$orderClass = $this->getOrderClass();
$this->assertNotEmpty($orderClass::find()->with('customer')->indexBy('customer.id')->all());
}
}

Loading…
Cancel
Save