[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorEdgeTestCase extends PhabricatorTestCase { 4 5 protected function getPhabricatorTestCaseConfiguration() { 6 return array( 7 self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true, 8 ); 9 } 10 11 public function testCycleDetection() { 12 13 // The editor should detect that this introduces a cycle and prevent the 14 // edit. 15 16 $user = new PhabricatorUser(); 17 18 $obj1 = id(new HarbormasterObject())->save(); 19 $obj2 = id(new HarbormasterObject())->save(); 20 $phid1 = $obj1->getPHID(); 21 $phid2 = $obj2->getPHID(); 22 23 $editor = id(new PhabricatorEdgeEditor()) 24 ->addEdge($phid1, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid2) 25 ->addEdge($phid2, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid1); 26 27 $caught = null; 28 try { 29 $editor->save(); 30 } catch (Exception $ex) { 31 $caught = $ex; 32 } 33 34 $this->assertTrue($caught instanceof Exception); 35 36 37 // The first edit should go through (no cycle), bu the second one should 38 // fail (it introduces a cycle). 39 40 $editor = id(new PhabricatorEdgeEditor()) 41 ->addEdge($phid1, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid2) 42 ->save(); 43 44 $editor = id(new PhabricatorEdgeEditor()) 45 ->addEdge($phid2, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid1); 46 47 $caught = null; 48 try { 49 $editor->save(); 50 } catch (Exception $ex) { 51 $caught = $ex; 52 } 53 54 $this->assertTrue($caught instanceof Exception); 55 } 56 57 58 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |