Example #1
0
 /**
  * Test fixed-up models
  * 
  * The fixup process removes the db connection from the schema, so we need to
  * manually specify it here.
  */
 public function testModels()
 {
     $this->initConnections();
     // Create an entry to satisfy later constraints
     $node = $this->createKnownNode(new TestModelKnownNode(), $this->conNode);
     try {
         $organiser = new TestModelTestOrganiser();
         $organiser->setCreatorNodeId($node->getPrimaryKey());
         $organiser->setName($orgName = 'Mr. Badger');
         $event = new TestModelTestEvent();
         $event->setCreatorNodeId($node->getPrimaryKey());
         $event->setName($eventName = 'Expert Burrowing In The Built Environment');
         $event->setTestModelTestOrganiser($organiser);
         $event->save($this->conNode);
         $ok = true;
     } catch (Exception $e) {
         // @todo Remove this temporary error reporting
         echo 'Error: ' . $e->getMessage() . "\n";
         $ok = false;
     }
     $this->assertTrue($ok, 'Save some rows to the test model');
     // Check they have been written okay
     $organiser = TestModelTestOrganiserQuery::create()->findOneByName($orgName, $this->conNode);
     $event = TestModelTestEventQuery::create()->findOneByName($eventName, $this->conNode);
     $this->assertTrue($organiser instanceof TestModelTestOrganiser && $event instanceof TestModelTestEvent, 'Retrieve rows from the database');
 }
Example #2
0
 /**
  * Checks that the version hash is working
  */
 public function testVersionHash()
 {
     $strategy = $this->useVersionStrategy();
     // Get an organiser record
     $organiser = TestModelTestOrganiserQuery::create()->findOne($this->conNode);
     // Create a record
     $event = new TestModelTestEvent();
     $event->setCreatorNodeId($this->node->getId());
     $event->setName('Small-Scale Oil Drilling For Cats');
     $event->setTestModelTestOrganiser($organiser);
     $event->save($this->conNode);
     // @todo ...
 }