public function test_has_relation() { $cities_with_country = Stub_Test_Model_City::has('country')->get(); $all_cities = Stub_Test_Model_City::all(); $this->assertCount(16, $cities_with_country); $this->assertCount(18, $all_cities); }
public function test_custom_foreign_key_through_two() { $city = Stub_Test_Model_City::where('id', 1)->first(); $this->assertNotNull($city->offshoreCountry); $this->assertEquals(1, $city->offshoreCountry->id); }