Beispiel #1
0
 public function testSnapshotNormalComplex()
 {
     $this->specify("Normal complex snapshots don't work", function () {
         $robots = $this->modelsManager->executeQuery('SELECT * FROM ' . SnapshotRobots::class);
         foreach ($robots as $robot) {
             $robot->name = 'Some';
             $robot->year = 1999;
             expect($robot->hasChanged('name'))->true();
             expect($robot->hasChanged('year'))->true();
             expect($robot->hasChanged('type'))->false();
             expect($robot->hasChanged())->true();
             expect($robot->getChangedFields())->equals(array('name', 'year'));
         }
         $robots = $this->modelsManager->executeQuery('SELECT robot.*, parts.* FROM ' . SnapshotRobots::class . ' robot JOIN ' . SnapshotRobotsParts::class . ' parts');
         foreach ($robots as $row) {
             $row->robot->name = 'Some';
             $row->robot->year = 1999;
             expect($row->robot->hasChanged('name'))->true();
             expect($row->robot->hasChanged('year'))->true();
             expect($row->robot->hasChanged('type'))->false();
             expect($row->robot->hasChanged())->true();
             expect($row->robot->getChangedFields())->equals(array('name', 'year'));
             $this->assertFalse($row->parts->hasSnapshotData());
         }
     });
 }