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

JBZoo / Codestyle / 8277548898

27 Jan 2024 09:57PM UTC coverage: 87.805% (-0.6%) from 88.424%
8277548898

push

github

web-flow
PHP 8.3 + Update deps (#48)

5 of 15 new or added lines in 1 file covered. (33.33%)

44 existing lines in 5 files now uncovered.

540 of 615 relevant lines covered (87.8%)

10.35 hits per line

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

0.0
/src/PHPUnit/AbstractPhpStormProxyTest.php
1
<?php
2

3
/**
4
 * JBZoo Toolbox - Codestyle.
5
 *
6
 * This file is part of the JBZoo Toolbox project.
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license    MIT
11
 * @copyright  Copyright (C) JBZoo.com, All rights reserved.
12
 * @see        https://github.com/JBZoo/Codestyle
13
 */
14

15
declare(strict_types=1);
16

17
namespace JBZoo\Codestyle\PHPUnit;
18

19
use JBZoo\PHPUnit\PHPUnit;
20
use JBZoo\Utils\Cli;
21
use JBZoo\Utils\Env;
22

23
use function JBZoo\PHPUnit\isPhpStorm;
24
use function JBZoo\PHPUnit\skip;
25
use function JBZoo\PHPUnit\success;
26

27
abstract class AbstractPhpStormProxyTest extends PHPUnit
28
{
29
    public function testPhpCsFixerFix(): void
30
    {
31
        $this->runToolViaMakefile('test-phpcsfixer-fix');
×
32
    }
33

34
    /**
35
     * @depends testPhpCsFixerFix
36
     */
37
    public function testPhpCsFixerCheck(): void
38
    {
39
        $this->runToolViaMakefile('test-phpcsfixer-teamcity');
×
40
    }
41

42
    /**
43
     * @depends testPhpCsFixerCheck
44
     */
45
    public function testPhpCodeSniffer(): void
46
    {
47
        $this->runToolViaMakefile('test-phpcs-teamcity');
×
48
    }
49

50
    public function testPhpMessDetector(): void
51
    {
52
        $this->runToolViaMakefile('test-phpmd-teamcity');
×
53
    }
54

55
    public function testPhpMagicNumbers(): void
56
    {
57
        $this->runToolViaMakefile('test-phpmnd-teamcity');
×
58
    }
59

60
    /**
61
     * @depends testPhpCodeSniffer
62
     */
63
    public function testPhpStan(): void
64
    {
65
        $this->runToolViaMakefile('test-phpstan-teamcity');
×
66
    }
67

68
    /**
69
     * @depends testPhpStan
70
     */
71
    public function testPsalm(): void
72
    {
73
        $this->runToolViaMakefile('test-psalm-teamcity');
×
74
    }
75

76
    /**
77
     * @depends testPsalm
78
     */
79
    public function testPhan(): void
80
    {
81
        $this->runToolViaMakefile('test-phan-teamcity');
×
82
    }
83

84
    /**
85
     * Test works only in PhpStorm or TeamCity if variable PHPSTORM_PROXY=1
86
     * Please, use `make codestyle` for any other environments.
87
     */
88
    protected function runToolViaMakefile(string $makeTargetName): void
89
    {
90
        $testCaseEnvVariable = $this->getEnvVariableForTestCase($makeTargetName);
×
91

92
        if (
93
            isPhpStorm()
×
94
            && (Env::bool('PHPSTORM_PROXY') || Env::bool($testCaseEnvVariable))
×
95
        ) {
96
            $phpBin = Env::string('PHP_BIN', 'php');
×
97

98
            $cliCommand = \implode(' ', [
×
UNCOV
99
                'TC_REPORT="tc-tests"',
UNCOV
100
                'TC_REPORT_MND="tc-tests"',
UNCOV
101
                'TEAMCITY_VERSION="2020.1.2"',
102
                "PHP_BIN=\"{$phpBin}\"",
×
103
                "make {$makeTargetName}",
×
UNCOV
104
            ]);
105

106
            // Redirect error to std output
107
            try {
108
                Cli::out(\trim(Cli::exec($cliCommand, [], PROJECT_ROOT)));
×
109
            } catch (\Exception $exception) {
×
110
                Cli::out(\trim($exception->getMessage()));
×
111
            }
112
        } else {
113
            skip("Define env.PHPSTORM_PROXY=1 or env.{$testCaseEnvVariable}=1");
×
114
        }
115

116
        success();
×
117
    }
118

119
    /**
120
     * @suppress PhanPluginPossiblyStaticPrivateMethod
121
     */
122
    private function getEnvVariableForTestCase(string $makeTargetName): string
123
    {
124
        $makeTargetName = \str_replace(['test-', '-teamcity', '-'], ['', '', '_'], $makeTargetName);
×
125
        $makeTargetName = \strtoupper($makeTargetName);
×
126

127
        return "PHPSTORM_PROXY_{$makeTargetName}";
×
128
    }
129
}
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

© 2025 Coveralls, Inc