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

JBZoo / Codestyle / 18063683129

27 Sep 2025 06:57PM UTC coverage: 80.896% (-6.8%) from 87.66%
18063683129

push

github

web-flow
test(ci): Update PHP versions and fix workflow tests (#54)

- Update PHP versions in CI workflows from 8.1-8.3 to 8.2-8.4.
- Remove the unnecessary scheduled CI job.
- Adjust `TraitGithubActions` to validate the updated workflow
configuration.
- Fix badge line formatting in `TraitReadme` test.

4 of 4 new or added lines in 2 files covered. (100.0%)

79 existing lines in 7 files now uncovered.

542 of 670 relevant lines covered (80.9%)

10.91 hits per line

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

75.0
/src/PHPUnit/AbstractPackageTest.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 Symfony\Component\Finder\Finder;
22

23
use function JBZoo\PHPUnit\isTrue;
24
use function JBZoo\PHPUnit\openFile;
25

26
abstract class AbstractPackageTest extends PHPUnit
27
{
28
    use TraitComposer;
29
    use TraitCopyright;
30
    use TraitGithubActions;
31
    use TraitOtherTests;
32
    use TraitReadme;
33

34
    // ### Other properties. ###########################################################################################
35
    protected const DEBUG_MODE = false;
36

37
    // Important! Overload these properties in your test class.
38
    protected string $packageName = '';
39

40
    /** @psalm-suppress PossiblyUnusedProperty */
41
    protected string $gaScheduleMinute = '';
42

43
    // ### Default values. #############################################################################################
44
    // General
45
    protected string $vendorName = 'JBZoo';
46

47
    // Composer
48
    protected string $composerDevVersion = '7.x-dev';
49
    protected string $composerPhpVersion = '^8.2';
50
    protected string $composerType       = 'library';
51
    protected string $composerLicense    = 'MIT';
52

53
    protected string $projectRoot         = PROJECT_ROOT;
54
    protected string $copyrightVendorName = 'JBZoo Toolbox';
55
    protected string $copyrightLicense    = 'MIT';
56
    protected string $copyrightRights     = 'Copyright (C) JBZoo.com, All rights reserved.';
57
    protected string $copyrightSee        = 'https://github.com/_VENDOR_NS_/_PACKAGE_';
58

59
    // Internal variables
60
    protected string $packageNamespace = '';
61

62
    /**
63
     * {@inheritDoc}
64
     */
65
    protected function setUp(): void
66
    {
67
        parent::setUp();
168✔
68

69
        if ($this->packageName === '') {
168✔
UNCOV
70
            throw new Exception('$this->packageName is undefined');
×
71
        }
72

73
        $projectRoot = (string)\realpath($this->projectRoot);
168✔
74

75
        if ($projectRoot === '') {
168✔
UNCOV
76
            throw new Exception('$this->projectRoot is undefined');
×
77
        }
78

79
        if (!\is_dir($this->projectRoot)) {
168✔
UNCOV
80
            throw new Exception('$this->projectRoot not exists');
×
81
        }
82

83
        $this->projectRoot      = $projectRoot;
168✔
84
        $this->packageNamespace = \str_replace('-', '', $this->packageName);
168✔
85
    }
86

87
    public static function checkFiles(string $testcaseName, Finder $finder, \Closure $testCaseFunction): int
88
    {
89
        if (static::DEBUG_MODE) {
66✔
UNCOV
90
            Cli::out("Count: {$finder->count()}; Method: {$testcaseName}");
×
91
        }
92

93
        foreach ($finder as $file) {
66✔
94
            $pathname = $file->getPathname();
66✔
95
            $content  = (string)openFile($pathname);
66✔
96

97
            if (static::DEBUG_MODE) {
66✔
UNCOV
98
                Cli::out(" * {$pathname}");
×
99
            }
100

101
            $testCaseFunction($content, $pathname);
66✔
102
        }
103

104
        isTrue(true); // One assert is a minimum for test complete
66✔
105

106
        return $finder->count();
66✔
107
    }
108
}
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