• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

orchestral / testbench-core / 11968150625

22 Nov 2024 07:13AM UTC coverage: 91.991% (+0.7%) from 91.321%
11968150625

Pull #265

github

crynobone
[7.x] Allow to configure `tty` via `Orchestra\Testbench\remote()`
function

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Pull Request #265: [7.x] Allow to configure `tty` via `Orchestra\Testbench\remote()`

3 of 4 new or added lines in 1 file covered. (75.0%)

93 existing lines in 25 files now uncovered.

1206 of 1311 relevant lines covered (91.99%)

61.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/Bootstrap/LoadConfigurationWithWorkbench.php
1
<?php
2

3
namespace Orchestra\Testbench\Bootstrap;
4

5
use Illuminate\Support\Collection;
6
use Illuminate\Support\LazyCollection;
7
use Orchestra\Testbench\Workbench\Workbench;
8
use Symfony\Component\Finder\Finder;
9

10
use function Orchestra\Testbench\workbench_path;
11

12
/**
13
 * @internal
14
 */
15
class LoadConfigurationWithWorkbench extends LoadConfiguration
16
{
17
    /**
18
     * Determine if workbench config file should be loaded.
19
     *
20
     * @var bool
21
     */
22
    protected $usesWorkbenchConfigFile = false;
23

24
    /**
25
     * Construct a new bootstrap class.
26
     */
27
    public function __construct()
28
    {
29
        $this->usesWorkbenchConfigFile = (Workbench::configuration()->getWorkbenchDiscoversAttributes()['config'] ?? false)
30✔
30
            && is_dir(workbench_path('config'));
30✔
31
    }
32

33
    /**
34
     * Resolve the configuration file.
35
     *
36
     * @param  string  $path
37
     * @param  string  $key
38
     * @return string
39
     */
40
    protected function resolveConfigurationFile(string $path, string $key): string
41
    {
42
        return $this->usesWorkbenchConfigFile === true && is_file(workbench_path('config', "{$key}.php"))
30✔
UNCOV
43
            ? workbench_path('config', "{$key}.php")
×
44
            : $path;
30✔
45
    }
46

47
    /**
48
     * Extend the loaded configuration.
49
     *
50
     * @param  \Illuminate\Support\Collection  $configurations
51
     * @return \Illuminate\Support\Collection
52
     */
53
    protected function extendsLoadedConfiguration(Collection $configurations): Collection
54
    {
55
        if ($this->usesWorkbenchConfigFile === false) {
30✔
UNCOV
56
            return $configurations;
×
57
        }
58

59
        LazyCollection::make(function () {
30✔
60
            $path = workbench_path('config');
30✔
61

62
            foreach (Finder::create()->files()->name('*.php')->in($path) as $file) {
30✔
63
                $directory = $this->getNestedDirectory($file, $path);
30✔
64

65
                yield $directory.basename($file->getRealPath(), '.php') => $file->getRealPath();
30✔
66
            }
67
        })->reject(static function ($path, $key) use ($configurations) {
30✔
68
            return $configurations->has($key);
30✔
69
        })->each(static function ($path, $key) use ($configurations) {
30✔
70
            $configurations->put($key, $path);
30✔
71
        });
30✔
72

73
        return $configurations;
30✔
74
    }
75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc