Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/phutil/PhutilTestCase.php
| Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | /* -( Exception Handling )------------------------------------------------- */ | ||||
| * This simplest way to assert exceptions are thrown. | * This simplest way to assert exceptions are thrown. | ||||
| * | * | ||||
| * @param exception The expected exception. | * @param exception The expected exception. | ||||
| * @param callable The thing which throws the exception. | * @param callable The thing which throws the exception. | ||||
| * | * | ||||
| * @return void | * @return void | ||||
| * @task exceptions | * @task exceptions | ||||
| */ | */ | ||||
| final protected function assertException($expected_exception_class, | final protected function assertException( | ||||
| $expected_exception_class, | |||||
| $callable) { | $callable) { | ||||
| $this->tryTestCases( | $this->tryTestCases( | ||||
| array('assertException' => array()), | array('assertException' => array()), | ||||
| array(false), | array(false), | ||||
| $callable, | $callable, | ||||
| $expected_exception_class); | $expected_exception_class); | ||||
| } | } | ||||
| /** | /** | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | /* -( Exception Handling )------------------------------------------------- */ | ||||
| * 'Exception'. | * 'Exception'. | ||||
| * @return void | * @return void | ||||
| * @task exceptions | * @task exceptions | ||||
| */ | */ | ||||
| final protected function tryTestCaseMap( | final protected function tryTestCaseMap( | ||||
| array $map, | array $map, | ||||
| $callable, | $callable, | ||||
| $exception_class = 'Exception') { | $exception_class = 'Exception') { | ||||
| return $this->tryTestCases( | return $this->tryTestCases( | ||||
| array_fuse(array_keys($map)), | array_fuse(array_keys($map)), | ||||
| array_values($map), | array_values($map), | ||||
| $callable, | $callable, | ||||
| $exception_class); | $exception_class); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | $uri = id(new PhutilURI($base_uri)) | ||||
| ->setPath("/diffusion/symbol/{$method}/") | ->setPath("/diffusion/symbol/{$method}/") | ||||
| ->setQueryParam('context', get_class($this)) | ->setQueryParam('context', get_class($this)) | ||||
| ->setQueryParam('jump', 'true') | ->setQueryParam('jump', 'true') | ||||
| ->setQueryParam('lang', 'php'); | ->setQueryParam('lang', 'php'); | ||||
| return (string)$uri; | return (string)$uri; | ||||
| } | } | ||||
| public function setRenderer(ArcanistUnitRenderer $renderer) { | final public function setRenderer(ArcanistUnitRenderer $renderer) { | ||||
| $this->renderer = $renderer; | $this->renderer = $renderer; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| /** | /** | ||||
| * Returns info about the caller function. | * Returns info about the caller function. | ||||
| * | * | ||||
| * @return map | * @return map | ||||
| ▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines | |||||