public function testMagicMethods() { $dao = new LiskIsolationTestDAO(); $this->assertEqual(null, $dao->getName(), 'getName() on empty object'); $this->assertEqual($dao, $dao->setName('x'), 'setName() returns $this'); $this->assertEqual('y', $dao->setName('y')->getName(), 'setName() has an effect'); $ex = null; try { $dao->gxxName(); } catch (Exception $thrown) { $ex = $thrown; } $this->assertTrue((bool) $ex, 'Typoing "get" should throw.'); $ex = null; try { $dao->sxxName('z'); } catch (Exception $thrown) { $ex = $thrown; } $this->assertTrue((bool) $ex, 'Typoing "set" should throw.'); $ex = null; try { $dao->madeUpMethod(); } catch (Exception $thrown) { $ex = $thrown; } $this->assertTrue((bool) $ex, 'Made up method should throw.'); }
public function testIsolationContainment() { $dao = new LiskIsolationTestDAO(); try { $dao->establishLiveConnection('r'); $this->assertFailure("LiskIsolationTestDAO did not throw an exception when instructed to " . "explicitly connect to an external database."); } catch (LiskIsolationTestDAOException $ex) { // Expected, pass. } }
public function getData() { $isolation = new LiskIsolationTestDAO(); $isolation->getData(); }