public function testGetAllPersistedOfRoot() { $a = Vehicle::getAllPersistedAttributes(); sort($a); $this->assertEquals(['color', 'owner_id'], $a); }
/** * @expectedException \Nanigans\SingleTableInheritance\Exceptions\SingleTableInheritanceException */ public function testNewFromBuilderThrowsIfClassTypeIsUnrecognized() { $vehicle = new Vehicle(); $attr = new \stdClass(); $attr->type = 'junk'; $vehicle->newFromBuilder($attr); }
public function testUpdateRemovesScope() { $car = new Car(); $car->color = 'red'; $car->save(); $dbCar = Vehicle::where('color', 'red')->first(); $dbCar->color = 'green'; $this->assertTrue($dbCar->save()); // if the scope doesn't remove bindings this save will throw an exception. }