public function testQueryingOnChild() { (new MotorVehicle())->save(); (new Car())->save(); (new Truck())->save(); (new Truck())->save(); (new Bike())->save(); $results = MotorVehicle::all(); $this->assertEquals(4, count($results)); $this->assertInstanceOf('Phaza\\SingleTableInheritance\\Tests\\Fixtures\\MotorVehicle', $results[0]); $this->assertInstanceOf('Phaza\\SingleTableInheritance\\Tests\\Fixtures\\Car', $results[1]); $this->assertInstanceOf('Phaza\\SingleTableInheritance\\Tests\\Fixtures\\Truck', $results[2]); $this->assertInstanceOf('Phaza\\SingleTableInheritance\\Tests\\Fixtures\\Truck', $results[3]); }
public function testGetAllPersistedOfChild() { $a = MotorVehicle::getAllPersistedAttributes(); sort($a); $this->assertEquals(['color', 'fuel', 'owner_id'], $a); }