Skip to content

Commit

Permalink
Merge branch '5.6' of github.com:sikhlana/framework into 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
sikhlana committed Jan 21, 2018
2 parents 2dcf7f8 + 9432395 commit fcbc5d6
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-5.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Contracts/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ 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);

/**
* Register a binding with the container.
*
* @param string|array $abstract
* @param string $abstract
* @param \Closure|string|null $concrete
* @param bool $shared
* @return void
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Concerns/BuildsQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ['*'])
{
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/RouteListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
15 changes: 15 additions & 0 deletions src/Illuminate/Foundation/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
6 changes: 6 additions & 0 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}

Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

/**
Expand Down
16 changes: 16 additions & 0 deletions tests/Foundation/FoundationTestResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
10 changes: 10 additions & 0 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit fcbc5d6

Please sign in to comment.