No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
6909c3c
... +0 ...
0b1ad6e
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
25 | 25 | */ |
|
26 | 26 | public function isColored() |
|
27 | 27 | { |
|
28 | - | return isset($this->config['color_support']) |
|
29 | - | ? $this->config['color_support'] |
|
28 | + | return $this->config['color_support'] ?? |
|
30 | 29 | // @codeCoverageIgnoreStart |
|
31 | - | : (DIRECTORY_SEPARATOR === '\\' |
|
30 | + | (DIRECTORY_SEPARATOR === '\\' |
|
32 | 31 | ? false !== getenv('ANSICON') || |
|
33 | 32 | 'ON' === getenv('ConEmuANSI') || |
|
34 | 33 | false !== getenv('BABUN_HOME') |
76 | 76 | $arguments = array_filter($arguments, function ($argument) { |
|
77 | 77 | return $argument !== '--verbose' && $argument !== '-v'; |
|
78 | 78 | }); |
|
79 | - | $this->configFile = isset($arguments[1]) ? $arguments[1] : $multiTester->getMultiTesterFile(); |
|
79 | + | $this->configFile = $arguments[1] ?? $multiTester->getMultiTesterFile(); |
|
80 | 80 | $this->addProjects(); |
|
81 | 81 | ||
82 | 82 | if (!file_exists($this->configFile)) { |
157 | 157 | unset($config['config']); |
|
158 | 158 | } |
|
159 | 159 | ||
160 | - | $this->projects = isset($config['projects']) ? $config['projects'] : $config; |
|
160 | + | $this->projects = $config['projects'] ?? $config; |
|
161 | 161 | } |
|
162 | 162 | ||
163 | 163 | /** |
168 | 168 | if (!file_exists($this->composerFile)) { |
|
169 | 169 | throw new MultiTesterException("Set the 'directory' entry to a path containing a composer.json file."); |
|
170 | 170 | } |
|
171 | + | ||
171 | 172 | $this->data = new File($this->composerFile); |
|
173 | + | ||
172 | 174 | if (!isset($this->data['name'])) { |
|
173 | 175 | throw new MultiTesterException("The composer.json file must contains a 'name' entry."); |
|
174 | 176 | } |
|
177 | + | ||
175 | 178 | $this->packageName = $this->data['name']; |
|
176 | 179 | } |
|
177 | 180 | } |
174 | 174 | $package = $this->getPackage(); |
|
175 | 175 | $tester = $this->getConfig()->getTester(); |
|
176 | 176 | $composerSettings = $tester->getComposerSettings($package); |
|
177 | - | $version = $this->filterVersion($settings['version'], array_keys($composerSettings ?? [])); |
|
177 | + | $version = $this->filterVersion($settings['version'], array_keys($composerSettings ?: [])); |
|
178 | 178 | ||
179 | 179 | $settings['source'] = isset($composerSettings[$version]['source']) |
|
180 | 180 | ? $composerSettings[$version]['source'] |
17 | 17 | use StorageDirectory; |
|
18 | 18 | use ProcStreams; |
|
19 | 19 | use Verbose; |
|
20 | + | ||
20 | 21 | /** |
|
21 | 22 | * @var array|File Composer package settings cache. |
|
22 | 23 | */ |
29 | 30 | ||
30 | 31 | public function __construct($storageDirectory = null) |
|
31 | 32 | { |
|
32 | - | $this->storageDirectory = $storageDirectory ?? sys_get_temp_dir(); |
|
33 | + | $this->storageDirectory = $storageDirectory ?: sys_get_temp_dir(); |
|
33 | 34 | } |
|
34 | 35 | ||
35 | 36 | public function exec($command, $quiet = false) |
43 | 44 | { |
|
44 | 45 | if (!isset($this->composerSettings[$package])) { |
|
45 | 46 | $this->composerSettings[$package] = new File("https://repo.packagist.org/p/$package.json"); |
|
46 | - | $this->composerSettings[$package] = isset($this->composerSettings[$package]['packages'], $this->composerSettings[$package]['packages'][$package]) |
|
47 | - | ? $this->composerSettings[$package]['packages'][$package] |
|
48 | - | : null; |
|
47 | + | $this->composerSettings[$package] = ($this->composerSettings[$package]['packages'] ?? [])[$package] ?? null; |
|
49 | 48 | } |
|
50 | 49 | ||
51 | 50 | return $this->composerSettings[$package]; |
55 | 54 | { |
|
56 | 55 | $streams = $this->getProcStreams(); |
|
57 | 56 | $stdout = is_array($streams) && isset($streams[1]) ? $streams[1] : null; |
|
57 | + | ||
58 | 58 | if (is_array($stdout) && $stdout[0] === 'file') { |
|
59 | 59 | $file = fopen($stdout[1], $stdout[2]); |
|
60 | 60 | fwrite($file, $text); |
197 | 197 | ||
198 | 198 | protected function extractVersion(&$package, &$settings) |
|
199 | 199 | { |
|
200 | - | list($package, $version) = explode(':', "$package:"); |
|
200 | + | [$package, $version] = explode(':', "$package:"); |
|
201 | 201 | ||
202 | 202 | if ($version !== '' && !isset($settings['version'])) { |
|
203 | 203 | $settings['version'] = $version; |
226 | 226 | } catch (TestFailedException $exception) { |
|
227 | 227 | $state = false; |
|
228 | 228 | ||
229 | - | if (isset($config->config['stop_on_failure']) && $config->config['stop_on_failure']) { |
|
229 | + | if ($config->config['stop_on_failure'] ?? false) { |
|
230 | 230 | $this->error($exception); |
|
231 | 231 | } |
|
232 | 232 | } catch (MultiTesterException $exception) { |
Files | Complexity | Coverage |
---|---|---|
src/MultiTester | ø | 100.00% |
Project Totals (12 files) | 188 | 100.00% |
0b1ad6e
6909c3c