close
Warning:
AdminModule failed with TracError: Unable to instantiate component <class 'trac.admin.web_ui.LoggingAdminPanel'> (super(type, obj): obj (type LoggingAdminPanel) is not an instance or subtype of type (Markup).)
|
Last change
on this file since db38696 was 01a620f, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago |
|
Removed submodules for php externals and use composer to provide them and versioned them afterwards
|
-
Property mode
set to
100644
|
|
File size:
1003 bytes
|
| Rev | Line | |
|---|
| [01a620f] | 1 | <?php
|
|---|
| 2 | namespace GuzzleHttp\Promise\Tests;
|
|---|
| 3 |
|
|---|
| 4 | use GuzzleHttp\Promise\RejectionException;
|
|---|
| 5 |
|
|---|
| 6 | class Thing1
|
|---|
| 7 | {
|
|---|
| 8 | public function __construct($message)
|
|---|
| 9 | {
|
|---|
| 10 | $this->message = $message;
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | public function __toString()
|
|---|
| 14 | {
|
|---|
| 15 | return $this->message;
|
|---|
| 16 | }
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | class Thing2 implements \JsonSerializable
|
|---|
| 20 | {
|
|---|
| 21 | public function jsonSerialize()
|
|---|
| 22 | {
|
|---|
| 23 | return '{}';
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | /**
|
|---|
| 28 | * @covers GuzzleHttp\Promise\RejectionException
|
|---|
| 29 | */
|
|---|
| 30 | class RejectionExceptionTest extends \PHPUnit_Framework_TestCase
|
|---|
| 31 | {
|
|---|
| 32 | public function testCanGetReasonFromException()
|
|---|
| 33 | {
|
|---|
| 34 | $thing = new Thing1('foo');
|
|---|
| 35 | $e = new RejectionException($thing);
|
|---|
| 36 |
|
|---|
| 37 | $this->assertSame($thing, $e->getReason());
|
|---|
| 38 | $this->assertEquals('The promise was rejected with reason: foo', $e->getMessage());
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | public function testCanGetReasonMessageFromJson()
|
|---|
| 42 | {
|
|---|
| 43 | $reason = new Thing2();
|
|---|
| 44 | $e = new RejectionException($reason);
|
|---|
| 45 | $this->assertContains("{}", $e->getMessage());
|
|---|
| 46 | }
|
|---|
| 47 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.
Download in other formats: