public function __construct($label = false) { // Same package name as test 2 parent::__construct('test_model', $label); $this->node = $this->createKnownNode(new TestModelKnownNode(), $this->conNode); // Create/empty the log $logDir = Meshing_Utils::getProjectRoot() . Meshing_Utils::getPaths()->getTestLogPath(); $this->logFile = $logDir . '/' . LOCKING_TEST_LOG; file_put_contents($this->logFile, ''); // Create test row $organiser = new TestModelTestOrganiser(); $organiser->setCreatorNodeId($this->node->getPrimaryKey()); $organiser->setName('Mr. Toad'); $organiser->save($this->conNode); }
public function testBasicHash() { $strategy = $this->useBasicStrategy(); // Create a record $organiser = new TestModelTestOrganiser(); $organiser->setCreatorNodeId($this->node->getId()); $organiser->setName('Organiser'); $organiser->setEmail('*****@*****.**'); $organiser->save($this->conNode); // Calc the hash and see if it is okay (interleaved 1s = "preceding value not null") $values = array($organiser->getId(), $organiser->getName(), $organiser->getEmail(), $organiser->getTestModelKnownNode($this->conNode)->getFqdn()); $out = ''; foreach ($values as $value) { $out .= $value . $strategy->getValueTerminator($value); } $expectedHash = sha1($out); $this->assertEqual($expectedHash, $organiser->getHash($this->conNode), 'Checking simple SHA1 works'); }