1 | <?php |
||
7 | class TestTranslationExtensions extends Command |
||
8 | { |
||
9 | /** |
||
10 | * The name and signature of the console command. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $signature = 'translation:test-extensions |
||
15 | {extensions?* : The extensions that should be tested} |
||
16 | {--no-database : Defines whether the tests should be performed without access to a database}'; |
||
17 | |||
18 | /** |
||
19 | * The console command description. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $description = 'Test if the registered TranslationManager extensions work in the way they are supposed to.'; |
||
24 | |||
25 | /** |
||
26 | * Create a new command instance. |
||
27 | * |
||
28 | * @return void |
||
|
|||
29 | */ |
||
30 | public function __construct() |
||
34 | |||
35 | /** |
||
36 | * Execute the console command. |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | public function handle() |
||
48 | |||
49 | /** |
||
50 | * Compose the phpunit command to be ran in order to perform the extension tests. |
||
51 | * |
||
52 | * @param string|null $extensionToRun |
||
53 | * @return string |
||
54 | */ |
||
55 | protected function makeCommand() |
||
72 | |||
73 | /** |
||
74 | * Returns the path to the phpunit.xml configuration file. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | protected function getPhpunitXmlPath() |
||
82 | |||
83 | /** |
||
84 | * Return the path to the file to be tested. |
||
85 | * We need to include this file manually |
||
86 | * in order to provide driver names that are to |
||
87 | * be tested after it. |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | protected function getTestFilePath() |
||
95 | |||
96 | /** |
||
97 | * We check if the user has provided any extensions here. |
||
98 | * If there are any provided extensions, we will use only |
||
99 | * those. |
||
100 | * Otherwise, we will fetch all the registered |
||
101 | * extensions from the TranslationDriver and |
||
102 | * test them all. |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | protected function prepareExtensions() |
||
116 | } |
||
117 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.