Skip to content

Commit c62e204

Browse files
derekmdbarryvdh
authored andcommitted
Allow dependency injected mocks to Manager (barryvdh#245)
By typehinting the Manager class constructor with concrete implementations, this package will affect Artisan tests in applications with Laravel 5.5 auto-discovery enabled. e.g., EventFake or Mockery partial used during Artisan integration tests will cause registration of this package's commands to fail due to the object not being concrete Illuminate\Events\Dispatcher. Instead use inversion of control to dependency inject by resolving Laravel contracts.
1 parent 209a29b commit c62e204

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Manager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?php namespace Barryvdh\TranslationManager;
22

3+
use Illuminate\Contracts\Events\Dispatcher;
4+
use Illuminate\Contracts\Foundation\Application;
35
use Illuminate\Filesystem\Filesystem;
4-
use Illuminate\Events\Dispatcher;
56
use Barryvdh\TranslationManager\Models\Translation;
6-
use Illuminate\Foundation\Application;
77
use Illuminate\Support\Facades\DB;
88
use Symfony\Component\Finder\Finder;
99

1010
class Manager{
1111

1212
const JSON_GROUP = '_json';
1313

14-
/** @var \Illuminate\Foundation\Application */
14+
/** @var \Illuminate\Contracts\Foundation\Application */
1515
protected $app;
1616
/** @var \Illuminate\Filesystem\Filesystem */
1717
protected $files;
18-
/** @var \Illuminate\Events\Dispatcher */
18+
/** @var \Illuminate\Contracts\Events\Dispatcher */
1919
protected $events;
2020

2121
protected $config;

0 commit comments

Comments
 (0)