Passed
Push — master ( dfdc1d...0594dd )
by Caen
03:44 queued 13s
created

anonymous//packages/realtime-compiler/tests/ConsoleOutputTest.php$0   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A ConsoleOutputTest.php$0 ➔ version() 0 3 1
1
<?php
2
3
use Hyde\Foundation\HydeKernel;
4
use Symfony\Component\Console\Output\BufferedOutput;
5
use Termwind\Repositories\Styles;
6
7
use function Termwind\{renderUsing};
0 ignored issues
show
Bug introduced by
The type Termwind\renderUsing was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
uses(\Hyde\Testing\UnitTestCase::class);
10
11
beforeEach(function () {
12
    renderUsing($this->output = new BufferedOutput());
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
13
14
    $this::mockConfig();
15
});
16
17
afterEach(function () {
18
    renderUsing(null);
19
20
    Styles::flush();
21
22
    HydeKernel::setInstance(new HydeKernel());
23
});
24
25
test('printStartMessage method', function () {
26
    HydeKernel::setInstance(new class extends HydeKernel
27
    {
28
        public static function version(): string
29
        {
30
            return '1.2.3';
31
        }
32
    });
33
34
    $output = new \Hyde\RealtimeCompiler\ConsoleOutput();
35
    $output->printStartMessage('localhost', 8000);
36
    $this->assertSame(<<<'TXT'
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
37
38
     ╭─────────────────────────────────────╮
39
     │                                     │
40
     │ HydePHP Realtime Compiler v1.2.3    │
41
     │                                     │
42
     │ Listening on: http://localhost:8000 │
43
     │                                     │
44
     ╰─────────────────────────────────────╯
45
46
47
    TXT, str_replace(["\u{A0}", "\r"], [' ', ''], $this->output->fetch()));
48
});
49