diff --git a/CHANGELOG-5.5.md b/CHANGELOG-5.5.md index 95211c788725..208e9061f1ec 100644 --- a/CHANGELOG-5.5.md +++ b/CHANGELOG-5.5.md @@ -2,6 +2,7 @@ ## v5.5.32 (2018-01-18) +### Fixed - Reverted `Collection::get()` changes [#22554](https://github.com/laravel/framework/pull/22554) ([6197e56](https://github.com/laravel/framework/commit/6197e563fab8511ce8bf9a006444fee26f015d3a), [af36f26](https://github.com/laravel/framework/commit/af36f26dad805a8d866555c979e92a9e0e1fa8ea)) diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index a4b479aea1d7..b75e734b30d1 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -206,7 +206,7 @@ public function isAlias($name) /** * Register a binding with the container. * - * @param string|array $abstract + * @param string $abstract * @param \Closure|string|null $concrete * @param bool $shared * @return void @@ -338,7 +338,7 @@ public function bindIf($abstract, $concrete = null, $shared = false) /** * Register a shared binding in the container. * - * @param string|array $abstract + * @param string $abstract * @param \Closure|string|null $concrete * @return void */ @@ -951,7 +951,7 @@ protected function unresolvablePrimitive(ReflectionParameter $parameter) /** * Register a new resolving callback. * - * @param string $abstract + * @param \Closure|string $abstract * @param \Closure|null $callback * @return void */ @@ -971,8 +971,8 @@ public function resolving($abstract, Closure $callback = null) /** * Register a new after resolving callback for all types. * - * @param string $abstract - * @param \Closure|null $callback + * @param \Closure|string $abstract + * @param \Closure|null $callback * @return void */ public function afterResolving($abstract, Closure $callback = null) diff --git a/src/Illuminate/Contracts/Container/Container.php b/src/Illuminate/Contracts/Container/Container.php index 44ae747d28f1..c68c645fcd12 100644 --- a/src/Illuminate/Contracts/Container/Container.php +++ b/src/Illuminate/Contracts/Container/Container.php @@ -36,7 +36,7 @@ public function tag($abstracts, $tags); /** * Resolve all of the bindings for a given tag. * - * @param array $tag + * @param string $tag * @return array */ public function tagged($tag); @@ -44,7 +44,7 @@ public function tagged($tag); /** * Register a binding with the container. * - * @param string|array $abstract + * @param string $abstract * @param \Closure|string|null $concrete * @param bool $shared * @return void @@ -64,7 +64,7 @@ public function bindIf($abstract, $concrete = null, $shared = false); /** * Register a shared binding in the container. * - * @param string|array $abstract + * @param string $abstract * @param \Closure|string|null $concrete * @return void */ @@ -136,7 +136,7 @@ public function resolved($abstract); /** * Register a new resolving callback. * - * @param string $abstract + * @param \Closure|string $abstract * @param \Closure|null $callback * @return void */ @@ -145,7 +145,7 @@ public function resolving($abstract, Closure $callback = null); /** * Register a new after resolving callback. * - * @param string $abstract + * @param \Closure|string $abstract * @param \Closure|null $callback * @return void */ diff --git a/src/Illuminate/Database/Concerns/BuildsQueries.php b/src/Illuminate/Database/Concerns/BuildsQueries.php index a815dda560ab..1051f2c91c85 100644 --- a/src/Illuminate/Database/Concerns/BuildsQueries.php +++ b/src/Illuminate/Database/Concerns/BuildsQueries.php @@ -70,7 +70,7 @@ public function each(callable $callback, $count = 1000) * Execute the query and get the first result. * * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|static|null + * @return \Illuminate\Database\Eloquent\Model|object|static|null */ public function first($columns = ['*']) { diff --git a/src/Illuminate/Foundation/Console/RouteListCommand.php b/src/Illuminate/Foundation/Console/RouteListCommand.php index 8675a9270345..b5cbb335bf1f 100644 --- a/src/Illuminate/Foundation/Console/RouteListCommand.php +++ b/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -163,7 +163,7 @@ protected function filterRoute(array $route) { if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) || $this->option('path') && ! Str::contains($route['uri'], $this->option('path')) || - $this->option('method') && ! Str::contains($route['method'], $this->option('method'))) { + $this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) { return; } diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index e997d4e7dede..1f77c47d443b 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -125,6 +125,21 @@ public function assertHeader($headerName, $value = null) return $this; } + /** + * Asserts that the response does not contains the given header. + * + * @param string $headerName + * @return $this + */ + public function assertHeaderMissing($headerName) + { + PHPUnit::assertFalse( + $this->headers->has($headerName), "Unexpected header [{$headerName}] is present on response." + ); + + return $this; + } + /** * Asserts that the response contains the given cookie and equals the optional value. * diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 088863c69c06..534d2d2e1700 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -570,6 +570,12 @@ function mix($path, $manifestDirectory = '') } if (file_exists(public_path($manifestDirectory.'/hot'))) { + $url = file_get_contents(public_path($manifestDirectory.'/hot')); + + if (Str::startsWith($url, ['http://', 'https://'])) { + return new HtmlString(Str::after($url, ':').$path); + } + return new HtmlString("//localhost:8080{$path}"); } diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index dadb5d965c58..6916063e3e73 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -22,7 +22,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess /** * The decoded JSON content for the request. * - * @var string + * @var \Symfony\Component\HttpFoundation\ParameterBag|null */ protected $json; @@ -314,7 +314,7 @@ public function replace(array $input) * * @param string $key * @param mixed $default - * @return mixed + * @return \Symfony\Component\HttpFoundation\ParameterBag|mixed */ public function json($key = null, $default = null) { @@ -479,7 +479,7 @@ public function fingerprint() /** * Set the JSON payload for the request. * - * @param array $json + * @param \Symfony\Component\HttpFoundation\ParameterBag $json * @return $this */ public function setJson($json) diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index 7b1c488fdec2..3c002607db42 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -34,7 +34,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate */ protected static $proxies = [ 'average', 'avg', 'contains', 'each', 'every', 'filter', 'first', 'flatMap', - 'keyBy', 'map', 'partition', 'reject', 'sortBy', 'sortByDesc', 'sum', + 'keyBy', 'map', 'partition', 'reject', 'sortBy', 'sortByDesc', 'sum', 'unique', ]; /** diff --git a/tests/Foundation/FoundationTestResponseTest.php b/tests/Foundation/FoundationTestResponseTest.php index 7d7f10302906..d04b4ac2f41a 100644 --- a/tests/Foundation/FoundationTestResponseTest.php +++ b/tests/Foundation/FoundationTestResponseTest.php @@ -64,12 +64,28 @@ public function testAssertHeader() try { $response->assertHeader('Location', '/bar'); + $this->fail('No exception was thrown'); } catch (\PHPUnit\Framework\ExpectationFailedException $e) { $this->assertEquals('/bar', $e->getComparisonFailure()->getExpected()); $this->assertEquals('/foo', $e->getComparisonFailure()->getActual()); } } + /** + * @expectedException \PHPUnit\Framework\ExpectationFailedException + * @expectedExceptionMessage Unexpected header [Location] is present on response. + */ + public function testAssertHeaderMissing() + { + $baseResponse = tap(new Response, function ($response) { + $response->header('Location', '/foo'); + }); + + $response = TestResponse::fromBaseResponse($baseResponse); + + $response->assertHeaderMissing('Location'); + } + public function testAssertJsonWithArray() { $response = TestResponse::fromBaseResponse(new Response(new JsonSerializableSingleResourceStub)); diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index d33b0b1b28a0..bbe048539984 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -341,6 +341,16 @@ public function testHigherOrderKeyBy() $this->assertEquals(['id1' => 'first', 'id2' => 'second'], $c->keyBy->id->map->name->all()); } + public function testHigherOrderUnique() + { + $c = new Collection([ + ['id' => '1', 'name' => 'first'], + ['id' => '1', 'name' => 'second'], + ]); + + $this->assertCount(1, $c->unique->id); + } + public function testHigherOrderFilter() { $c = new Collection([