public function testDelete()
 {
     $ford = new Mock\Car(array('brand' => 'Ford', 'colour' => 'Black', 'owner_id' => 3, 'doors' => 2, 'age' => 100));
     $ford->save();
     $fords = Mock\Car::FindAllByBrand('Ford');
     // Check the ford exists
     $this->assertEquals(1, count($fords));
     $fords->delete();
     $fords = Mock\Car::FindAllByBrand('Ford');
     $this->assertEquals(0, count($fords));
 }
Example #2
0
 public function testUpdateArray()
 {
     $options = array(1 => 'Sedan', 2 => 'Coupe');
     $type = $options[rand(1, 2)];
     $car = new Mock\Car(array('id' => 1, 'type' => $type));
     $this->assertTrue($car->save());
     $alfa = Mock\Car::Find(1);
     $this->assertEquals('Alfa Romeo', $alfa->brand);
     $this->assertEquals($type, $alfa->type);
 }