/** * @test */ public function it_passes_the_N_plus_1_problem() { $countries = Country::with('translations')->get(); foreach ($countries as $country) { $country->name; } $this->assertGreaterThan(2, count($countries)); $this->assertEquals(2, $this->queriesCount); }
public function test_getting_translation_does_not_create_translation() { $country = Country::with('translations')->find(1); $translation = $country->getTranslation('abc', false); $this->assertSame($translation, null); }