3 final class LiskIsolationTestCase
extends PhabricatorTestCase
{
5 public function testIsolatedWrites() {
6 $dao = new LiskIsolationTestDAO();
8 $this->assertEqual(null, $dao->getID(), pht('Expect no ID.'));
9 $this->assertEqual(null, $dao->getPHID(), pht('Expect no PHID.'));
11 $dao->save(); // Effects insert
14 $phid = $dao->getPHID();
16 $this->assertTrue((bool)$id, pht('Expect ID generated.'));
17 $this->assertTrue((bool)$phid, pht('Expect PHID generated.'));
19 $dao->save(); // Effects update
21 $this->assertEqual($id, $dao->getID(), pht('Expect ID unchanged.'));
22 $this->assertEqual($phid, $dao->getPHID(), pht('Expect PHID unchanged.'));
25 public function testEphemeral() {
26 $dao = new LiskIsolationTestDAO();
28 $dao->makeEphemeral();
37 array($this, 'saveDAO'));
40 public function saveDAO($dao) {
44 public function testIsolationContainment() {
45 $dao = new LiskIsolationTestDAO();
48 $method = new ReflectionMethod($dao, 'establishLiveConnection');
49 $method->setAccessible(true);
50 $method->invoke($dao, 'r');
54 '%s did not throw an exception when instructed to '.
55 'explicitly connect to an external database.',
56 'LiskIsolationTestDAO'));
57 } catch (LiskIsolationTestDAOException
$ex) {
61 $this->assertTrue(true);
64 public function testMagicMethods() {
66 $dao = new LiskIsolationTestDAO();
71 pht('%s on empty object', 'getName()'));
76 pht('%s returns %s', 'setName()', '$this'));
80 $dao->setName('y')->getName(),
81 pht('%s has an effect', 'setName()'));
86 } catch (Exception
$thrown) {
91 pht('Typoing "%s" should throw.', 'get'));
96 } catch (Exception
$thrown) {
101 pht('Typoing "%s" should throw.', 'set'));
105 $dao->madeUpMethod();
106 } catch (Exception
$thrown) {
111 pht('Made up method should throw.'));