| @@ 113-134 (lines=22) @@ | ||
| 110 | $this->setRequest($request); |
|
| 111 | } |
|
| 112 | ||
| 113 | public function getMatchers() |
|
| 114 | { |
|
| 115 | return [ |
|
| 116 | 'beAnUriWithPath' => function ($uri, $path) |
|
| 117 | { |
|
| 118 | if (!$uri instanceof UriInterface) { |
|
| 119 | $class = UriInterface::class; |
|
| 120 | $type = gettype($uri); |
|
| 121 | throw new FailureException( |
|
| 122 | "Expected {$class} instance, but got '{$type}'" |
|
| 123 | ); |
|
| 124 | } |
|
| 125 | ||
| 126 | if ($uri->__toString() !== $path) { |
|
| 127 | throw new FailureException( |
|
| 128 | "Expected URI with path '{$path}', but got '{$uri}'" |
|
| 129 | ); |
|
| 130 | } |
|
| 131 | return true; |
|
| 132 | } |
|
| 133 | ]; |
|
| 134 | } |
|
| 135 | } |
|
| 136 | ||
| @@ 30-51 (lines=22) @@ | ||
| 27 | ->shouldBeAnUriLike('http://test.com/path'); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function getMatchers() |
|
| 31 | { |
|
| 32 | return [ |
|
| 33 | 'beAnUriLike' => function ($uri, $path) |
|
| 34 | { |
|
| 35 | if (!$uri instanceof UriInterface) { |
|
| 36 | $class = UriInterface::class; |
|
| 37 | $type = gettype($uri); |
|
| 38 | throw new FailureException( |
|
| 39 | "Expected {$class} instance, but got '{$type}'" |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | if ($uri->__toString() !== $path) { |
|
| 44 | throw new FailureException( |
|
| 45 | "Expected URI with path '{$path}', but got '{$uri}'" |
|
| 46 | ); |
|
| 47 | } |
|
| 48 | return true; |
|
| 49 | } |
|
| 50 | ]; |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| @@ 141-162 (lines=22) @@ | ||
| 138 | $this->setRequest($request); |
|
| 139 | } |
|
| 140 | ||
| 141 | public function getMatchers() |
|
| 142 | { |
|
| 143 | return [ |
|
| 144 | 'beAnUriWithPath' => function ($uri, $path) |
|
| 145 | { |
|
| 146 | if (!$uri instanceof UriInterface) { |
|
| 147 | $class = UriInterface::class; |
|
| 148 | $type = gettype($uri); |
|
| 149 | throw new FailureException( |
|
| 150 | "Expected {$class} instance, but got '{$type}'" |
|
| 151 | ); |
|
| 152 | } |
|
| 153 | ||
| 154 | if ($uri->__toString() !== $path) { |
|
| 155 | throw new FailureException( |
|
| 156 | "Expected URI with path '{$path}', but got '{$uri}'" |
|
| 157 | ); |
|
| 158 | } |
|
| 159 | return true; |
|
| 160 | } |
|
| 161 | ]; |
|
| 162 | } |
|
| 163 | } |
|
| 164 | ||