Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/__tests__/PhutilUnitTestEngineTestCase.php
| Show All 37 Lines | $this->assertEqual( | ||||
| self::$distinctWillRunTests, | self::$distinctWillRunTests, | ||||
| self::$distinctDidRunTests, | self::$distinctDidRunTests, | ||||
| 'Expect same tests had pre- and post-run callbacks invoked.'); | 'Expect same tests had pre- and post-run callbacks invoked.'); | ||||
| } | } | ||||
| public function __destruct() { | public function __destruct() { | ||||
| if (self::$allTestsCounter !== 0) { | if (self::$allTestsCounter !== 0) { | ||||
| throw new Exception( | throw new Exception( | ||||
| "didRunTests() was not called correctly after tests completed!"); | 'didRunTests() was not called correctly after tests completed!'); | ||||
| } | } | ||||
| } | } | ||||
| protected function willRunOneTest($test) { | protected function willRunOneTest($test) { | ||||
| self::$distinctWillRunTests[$test] = true; | self::$distinctWillRunTests[$test] = true; | ||||
| self::$oneTestCounter++; | self::$oneTestCounter++; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | $this->tryTestCaseMap( | ||||
| 1 => true, | 1 => true, | ||||
| 0 => false, | 0 => false, | ||||
| ), | ), | ||||
| array($this, 'throwIfFalsey')); | array($this, 'throwIfFalsey')); | ||||
| } | } | ||||
| protected function throwIfFalsey($input) { | protected function throwIfFalsey($input) { | ||||
| if (!$input) { | if (!$input) { | ||||
| throw new Exception("This is a negative test case!"); | throw new Exception('This is a negative test case!'); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||