diff --git a/src/Illuminate/Database/Eloquent/Relations/Relation.php b/src/Illuminate/Database/Eloquent/Relations/Relation.php index bd2be0a451cc..9825e1010725 100755 --- a/src/Illuminate/Database/Eloquent/Relations/Relation.php +++ b/src/Illuminate/Database/Eloquent/Relations/Relation.php @@ -296,18 +296,6 @@ public function getQuery() return $this->query; } - /** - * Get the base query builder driving the Eloquent builder. - * - * @deprecated Use toBase() instead - * - * @return \Illuminate\Database\Query\Builder - */ - public function getBaseQuery() - { - return $this->toBase(); - } - /** * Get a base query builder instance. * diff --git a/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php b/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php deleted file mode 100644 index 5553fde625d2..000000000000 --- a/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php +++ /dev/null @@ -1,58 +0,0 @@ -wentDownAt = Date::createFromTimestamp($time); - - if ($retryAfter) { - $this->retryAfter = $retryAfter; - - $this->willBeAvailableAt = Date::instance(Carbon::createFromTimestamp($time)->addRealSeconds($this->retryAfter)); - } - } -} diff --git a/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php b/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php deleted file mode 100644 index 66622950c766..000000000000 --- a/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php +++ /dev/null @@ -1,289 +0,0 @@ -withoutEvents(); - - $this->beforeApplicationDestroyed(function () use ($events) { - $fired = $this->getFiredEvents($events); - - $this->assertEmpty( - $eventsNotFired = array_diff($events, $fired), - 'These expected events were not fired: ['.implode(', ', $eventsNotFired).']' - ); - }); - - return $this; - } - - /** - * Specify a list of events that should not be fired for the given operation. - * - * These events will be mocked, so that handlers will not actually be executed. - * - * @param array|string $events - * @return $this - */ - public function doesntExpectEvents($events) - { - $events = is_array($events) ? $events : func_get_args(); - - $this->withoutEvents(); - - $this->beforeApplicationDestroyed(function () use ($events) { - $this->assertEmpty( - $fired = $this->getFiredEvents($events), - 'These unexpected events were fired: ['.implode(', ', $fired).']' - ); - }); - - return $this; - } - - /** - * Mock the event dispatcher so all events are silenced and collected. - * - * @return $this - */ - protected function withoutEvents() - { - $mock = Mockery::mock(EventsDispatcherContract::class)->shouldIgnoreMissing(); - - $mock->shouldReceive('dispatch', 'until')->andReturnUsing(function ($called) { - $this->firedEvents[] = $called; - }); - - Event::clearResolvedInstances(); - - $this->app->instance('events', $mock); - - return $this; - } - - /** - * Filter the given events against the fired events. - * - * @param array $events - * @return array - */ - protected function getFiredEvents(array $events) - { - return $this->getDispatched($events, $this->firedEvents); - } - - /** - * Specify a list of jobs that should be dispatched for the given operation. - * - * These jobs will be mocked, so that handlers will not actually be executed. - * - * @param array|string $jobs - * @return $this - */ - protected function expectsJobs($jobs) - { - $jobs = is_array($jobs) ? $jobs : func_get_args(); - - $this->withoutJobs(); - - $this->beforeApplicationDestroyed(function () use ($jobs) { - $dispatched = $this->getDispatchedJobs($jobs); - - $this->assertEmpty( - $jobsNotDispatched = array_diff($jobs, $dispatched), - 'These expected jobs were not dispatched: ['.implode(', ', $jobsNotDispatched).']' - ); - }); - - return $this; - } - - /** - * Specify a list of jobs that should not be dispatched for the given operation. - * - * These jobs will be mocked, so that handlers will not actually be executed. - * - * @param array|string $jobs - * @return $this - */ - protected function doesntExpectJobs($jobs) - { - $jobs = is_array($jobs) ? $jobs : func_get_args(); - - $this->withoutJobs(); - - $this->beforeApplicationDestroyed(function () use ($jobs) { - $this->assertEmpty( - $dispatched = $this->getDispatchedJobs($jobs), - 'These unexpected jobs were dispatched: ['.implode(', ', $dispatched).']' - ); - }); - - return $this; - } - - /** - * Mock the job dispatcher so all jobs are silenced and collected. - * - * @return $this - */ - protected function withoutJobs() - { - $mock = Mockery::mock(BusDispatcherContract::class)->shouldIgnoreMissing(); - - $mock->shouldReceive('dispatch', 'dispatchNow')->andReturnUsing(function ($dispatched) { - $this->dispatchedJobs[] = $dispatched; - }); - - $this->app->instance( - BusDispatcherContract::class, $mock - ); - - return $this; - } - - /** - * Filter the given jobs against the dispatched jobs. - * - * @param array $jobs - * @return array - */ - protected function getDispatchedJobs(array $jobs) - { - return $this->getDispatched($jobs, $this->dispatchedJobs); - } - - /** - * Filter the given classes against an array of dispatched classes. - * - * @param array $classes - * @param array $dispatched - * @return array - */ - protected function getDispatched(array $classes, array $dispatched) - { - return array_filter($classes, function ($class) use ($dispatched) { - return $this->wasDispatched($class, $dispatched); - }); - } - - /** - * Check if the given class exists in an array of dispatched classes. - * - * @param string $needle - * @param array $haystack - * @return bool - */ - protected function wasDispatched($needle, array $haystack) - { - foreach ($haystack as $dispatched) { - if ((is_string($dispatched) && ($dispatched === $needle || is_subclass_of($dispatched, $needle))) || - $dispatched instanceof $needle) { - return true; - } - } - - return false; - } - - /** - * Mock the notification dispatcher so all notifications are silenced. - * - * @return $this - */ - protected function withoutNotifications() - { - $mock = Mockery::mock(NotificationDispatcher::class); - - $mock->shouldReceive('send')->andReturnUsing(function ($notifiable, $instance, $channels = []) { - $this->dispatchedNotifications[] = compact( - 'notifiable', 'instance', 'channels' - ); - }); - - $this->app->instance(NotificationDispatcher::class, $mock); - - return $this; - } - - /** - * Specify a notification that is expected to be dispatched. - * - * @param mixed $notifiable - * @param string $notification - * @return $this - */ - protected function expectsNotification($notifiable, $notification) - { - $this->withoutNotifications(); - - $this->beforeApplicationDestroyed(function () use ($notifiable, $notification) { - foreach ($this->dispatchedNotifications as $dispatched) { - $notified = $dispatched['notifiable']; - - if (($notified === $notifiable || - $notified->getKey() == $notifiable->getKey()) && - get_class($dispatched['instance']) === $notification - ) { - return $this; - } - } - - $this->fail('The following expected notification were not dispatched: ['.$notification.']'); - }); - - return $this; - } -} diff --git a/src/Illuminate/Foundation/Testing/TestCase.php b/src/Illuminate/Foundation/Testing/TestCase.php index d7e92b557288..7ba5092fa06c 100644 --- a/src/Illuminate/Foundation/Testing/TestCase.php +++ b/src/Illuminate/Foundation/Testing/TestCase.php @@ -27,8 +27,7 @@ abstract class TestCase extends BaseTestCase Concerns\InteractsWithExceptionHandling, Concerns\InteractsWithSession, Concerns\InteractsWithTime, - Concerns\InteractsWithViews, - Concerns\MocksApplicationServices; + Concerns\InteractsWithViews; /** * The Illuminate application instance. diff --git a/src/Illuminate/Support/Facades/Notification.php b/src/Illuminate/Support/Facades/Notification.php index e16a9cceaf7a..497026685a1a 100644 --- a/src/Illuminate/Support/Facades/Notification.php +++ b/src/Illuminate/Support/Facades/Notification.php @@ -17,7 +17,6 @@ * @method static void assertSentTo(mixed $notifiable, string|\Closure $notification, callable $callback = null) * @method static void assertSentOnDemandTimes(string $notification, int $times = 1) * @method static void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1) - * @method static void assertTimesSent(int $expectedCount, string $notification) * @method static void send(\Illuminate\Support\Collection|array|mixed $notifiables, $notification) * @method static void sendNow(\Illuminate\Support\Collection|array|mixed $notifiables, $notification) * diff --git a/src/Illuminate/Support/ServiceProvider.php b/src/Illuminate/Support/ServiceProvider.php index 6c530c121d3c..006128db264a 100755 --- a/src/Illuminate/Support/ServiceProvider.php +++ b/src/Illuminate/Support/ServiceProvider.php @@ -7,7 +7,6 @@ use Illuminate\Contracts\Foundation\CachesConfiguration; use Illuminate\Contracts\Foundation\CachesRoutes; use Illuminate\Contracts\Support\DeferrableProvider; -use Illuminate\Database\Eloquent\Factory as ModelFactory; use Illuminate\View\Compilers\BladeCompiler; abstract class ServiceProvider @@ -234,23 +233,6 @@ protected function loadMigrationsFrom($paths) }); } - /** - * Register Eloquent model factory paths. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param array|string $paths - * @return void - */ - protected function loadFactoriesFrom($paths) - { - $this->callAfterResolving(ModelFactory::class, function ($factory) use ($paths) { - foreach ((array) $paths as $path) { - $factory->load($path); - } - }); - } - /** * Setup an after resolving listener, or fire immediately if already resolved. * diff --git a/src/Illuminate/Support/Testing/Fakes/NotificationFake.php b/src/Illuminate/Support/Testing/Fakes/NotificationFake.php index c7b12f42d47c..ae3b47b8f033 100644 --- a/src/Illuminate/Support/Testing/Fakes/NotificationFake.php +++ b/src/Illuminate/Support/Testing/Fakes/NotificationFake.php @@ -179,20 +179,6 @@ public function assertSentTimes($notification, $expectedCount) ); } - /** - * Assert the total amount of times a notification was sent. - * - * @param int $expectedCount - * @param string $notification - * @return void - * - * @deprecated Use the assertSentTimes method instead - */ - public function assertTimesSent($expectedCount, $notification) - { - $this->assertSentTimes($notification, $expectedCount); - } - /** * Get all of the notifications matching a truth-test callback. * diff --git a/tests/Support/SupportTestingNotificationFakeTest.php b/tests/Support/SupportTestingNotificationFakeTest.php index 06f49b6a1655..322ead061f9e 100644 --- a/tests/Support/SupportTestingNotificationFakeTest.php +++ b/tests/Support/SupportTestingNotificationFakeTest.php @@ -138,9 +138,9 @@ public function testResettingNotificationId() $this->assertNotSame($id, $this->notification->id); } - public function testAssertTimesSent() + public function testAssertSentTimes() { - $this->fake->assertTimesSent(0, NotificationStub::class); + $this->fake->assertSentTimes(NotificationStub::class, 0); $this->fake->send($this->user, new NotificationStub); @@ -148,7 +148,7 @@ public function testAssertTimesSent() $this->fake->send(new UserStub, new NotificationStub); - $this->fake->assertTimesSent(3, NotificationStub::class); + $this->fake->assertSentTimes(NotificationStub::class, 3); } public function testAssertSentToTimes()