Skip to content

Commit

Permalink
[5.2] Avoid introducing breaking backward compatibility on patch rele…
Browse files Browse the repository at this point in the history
…ase. (#14409)

* [5.2] Avoid introducing breaking backward compatibility on patch
release.

Closes #14396

Signed-off-by: crynobone <crynobone@gmail.com>

* Add additional tests.

Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone authored and taylorotwell committed Jul 21, 2016
1 parent 1047748 commit 2e22e71
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Support/MessageBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ protected function isUnique($key, $message)
*/
public function has($key = null)
{
if (is_null($key)) {
return $this->any();
}

$keys = is_array($key) ? $key : func_get_args();

foreach ($keys as $key) {
Expand Down
10 changes: 10 additions & 0 deletions tests/Support/SupportMessageBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function testHasIndicatesExistence()
$container->add('foo', 'bar');
$this->assertTrue($container->has('foo'));
$this->assertFalse($container->has('bar'));
$this->assertTrue($container->has());
}

public function testHasAnyIndicatesExistence()
Expand All @@ -98,6 +99,15 @@ public function testHasIndicatesExistenceOfAllKeys()
$this->assertFalse($container->has(['foo', 'baz']));
}

public function testHasIndicatesNoneExistence()
{
$container = new MessageBag;
$container->setFormat(':message');

$this->assertFalse($container->has('foo'));
$this->assertFalse($container->has());
}

public function testAllReturnsAllMessages()
{
$container = new MessageBag;
Expand Down

0 comments on commit 2e22e71

Please sign in to comment.