ALPHA 3.0.2a

This commit is contained in:
TheGamecraft
2018-09-10 08:51:18 -04:00
parent 7fe13ae0a7
commit 0e0ef86b71
1404 changed files with 10604 additions and 33714 deletions

View File

@@ -480,7 +480,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
* @param bool $value
* @param callable $callback
* @param callable $default
* @return mixed
* @return static|mixed
*/
public function when($value, callable $callback, callable $default = null)
{
@@ -499,7 +499,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
* @param bool $value
* @param callable $callback
* @param callable $default
* @return mixed
* @return static|mixed
*/
public function unless($value, callable $callback, callable $default = null)
{
@@ -1245,7 +1245,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
* Push all of the given items onto the collection.
*
* @param \Traversable|array $source
* @return $this
* @return static
*/
public function concat($source)
{
@@ -1288,7 +1288,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
* Get one or a specified number of items randomly from the collection.
*
* @param int|null $number
* @return mixed
* @return static|mixed
*
* @throws \InvalidArgumentException
*/

View File

@@ -25,14 +25,16 @@ abstract class Facade
/**
* Convert the facade into a Mockery spy.
*
* @return void
* @return \Mockery\MockInterface
*/
public static function spy()
{
if (! static::isMock()) {
$class = static::getMockableClass();
static::swap($class ? Mockery::spy($class) : Mockery::spy());
return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) {
static::swap($spy);
});
}
}

View File

@@ -8,7 +8,7 @@ namespace Illuminate\Support\Facades;
* @method static bool check(string $value, string $hashedValue, array $options = [])
* @method static bool needsRehash(string $hashedValue, array $options = [])
*
* @see \Illuminate\Hashing\BcryptHasher
* @see \Illuminate\Hashing\HashManager
*/
class Hash extends Facade
{

View File

@@ -12,6 +12,7 @@ namespace Illuminate\Support\Facades;
* @method static \Illuminate\Routing\Route any(string $uri, \Closure|array|string|null $action = null)
* @method static \Illuminate\Routing\Route match(array|string $methods, string $uri, \Closure|array|string|null $action = null)
* @method static \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
* @method static \Illuminate\Routing\RouteRegistrar where(array $where)
* @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = [])
* @method static \Illuminate\Routing\PendingResourceRegistration apiResource(string $name, string $controller, array $options = [])
* @method static void apiResources(array $resources)

View File

@@ -51,6 +51,8 @@ abstract class Manager
*
* @param string $driver
* @return mixed
*
* @throws \InvalidArgumentException
*/
public function driver($driver = null)
{

View File

@@ -64,7 +64,7 @@ class Pluralizer
*/
public static function plural($value, $count = 2)
{
if ((int) $count === 1 || static::uncountable($value)) {
if ((int) abs($count) === 1 || static::uncountable($value)) {
return $value;
}

View File

@@ -2,6 +2,7 @@
namespace Illuminate\Support\Testing\Fakes;
use Closure;
use Illuminate\Support\Arr;
use PHPUnit\Framework\Assert as PHPUnit;
use Illuminate\Contracts\Events\Dispatcher;
@@ -134,7 +135,7 @@ class EventFake implements Dispatcher
*/
public function listen($events, $listener)
{
//
$this->dispatcher->listen($events, $listener);
}
/**
@@ -145,7 +146,7 @@ class EventFake implements Dispatcher
*/
public function hasListeners($eventName)
{
//
return $this->dispatcher->hasListeners($eventName);
}
/**
@@ -168,7 +169,7 @@ class EventFake implements Dispatcher
*/
public function subscribe($subscriber)
{
//
$this->dispatcher->subscribe($subscriber);
}
/**
@@ -207,7 +208,7 @@ class EventFake implements Dispatcher
{
$name = is_object($event) ? get_class($event) : (string) $event;
if ($this->shouldFakeEvent($name)) {
if ($this->shouldFakeEvent($name, $payload)) {
$this->events[$name][] = func_get_args();
} else {
$this->dispatcher->dispatch($event, $payload, $halt);
@@ -218,11 +219,22 @@ class EventFake implements Dispatcher
* Determine if an event should be faked or actually dispatched.
*
* @param string $eventName
* @param mixed $payload
* @return bool
*/
protected function shouldFakeEvent($eventName)
protected function shouldFakeEvent($eventName, $payload)
{
return empty($this->eventsToFake) || in_array($eventName, $this->eventsToFake);
if (empty($this->eventsToFake)) {
return true;
}
return collect($this->eventsToFake)
->filter(function ($event) use ($eventName, $payload) {
return $event instanceof Closure
? $event($eventName, $payload)
: $event === $eventName;
})
->isNotEmpty();
}
/**

View File

@@ -36,9 +36,15 @@ class MailFake implements Mailer
return $this->assertSentTimes($mailable, $callback);
}
$message = "The expected [{$mailable}] mailable was not sent.";
if (count($this->queuedMailables) > 0) {
$message .= ' Did you mean to use assertQueued() instead?';
}
PHPUnit::assertTrue(
$this->sent($mailable, $callback)->count() > 0,
"The expected [{$mailable}] mailable was not sent."
$message
);
}

View File

@@ -57,7 +57,7 @@ class NotificationFake implements NotificationFactory, NotificationDispatcher
{
PHPUnit::assertTrue(
($count = $this->sent($notifiable, $notification)->count()) === $times,
"Expected [{$notification}] to be sent {$count} times, but was sent {$times} times."
"Expected [{$notification}] to be sent {$times} times, but was sent {$count} times."
);
}