Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php
index ad289c1469..848dfe7b67 100644
--- a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php
+++ b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php
@@ -1,110 +1,112 @@
<?php
final class LiskIsolationTestCase extends PhabricatorTestCase {
public function testIsolatedWrites() {
$dao = new LiskIsolationTestDAO();
$this->assertEqual(null, $dao->getID(), 'Expect no ID.');
$this->assertEqual(null, $dao->getPHID(), 'Expect no PHID.');
$dao->save(); // Effects insert
$id = $dao->getID();
$phid = $dao->getPHID();
$this->assertTrue((bool)$id, 'Expect ID generated.');
$this->assertTrue((bool)$phid, 'Expect PHID generated.');
$dao->save(); // Effects update
$this->assertEqual($id, $dao->getID(), 'Expect ID unchanged.');
$this->assertEqual($phid, $dao->getPHID(), 'Expect PHID unchanged.');
}
public function testEphemeral() {
$dao = new LiskIsolationTestDAO();
$dao->save();
$dao->makeEphemeral();
$this->tryTestCases(
array(
$dao,
),
array(
false,
),
array($this, 'saveDAO'));
}
public function saveDAO($dao) {
$dao->save();
}
public function testIsolationContainment() {
$dao = new LiskIsolationTestDAO();
try {
- $dao->establishLiveConnection('r');
+ $method = new ReflectionMethod($dao, 'establishLiveConnection');
+ $method->setAccessible(true);
+ $method->invoke($dao, 'r');
$this->assertFailure(
'LiskIsolationTestDAO did not throw an exception when instructed to '.
'explicitly connect to an external database.');
} catch (LiskIsolationTestDAOException $ex) {
// Expected, pass.
}
$this->assertTrue(true);
}
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.');
}
}
diff --git a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php
index 02c79544db..7d5a5d6021 100644
--- a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php
+++ b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php
@@ -1,32 +1,32 @@
<?php
final class LiskIsolationTestDAO extends LiskDAO {
protected $name;
protected $phid;
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
) + parent::getConfiguration();
}
public function generatePHID() {
return PhabricatorPHID::generateNewPHID('TISO');
}
- public function establishLiveConnection($mode) {
+ protected function establishLiveConnection($mode) {
throw new LiskIsolationTestDAOException(
'Isolation failure! DAO is attempting to connect to an external '.
'resource!');
}
- public function getConnectionNamespace() {
+ protected function getConnectionNamespace() {
return 'test';
}
public function getTableName() {
return 'test';
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Nov 30, 10:49 PM (15 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
429930
Default Alt Text
(4 KB)

Event Timeline