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

The-oGlow / ezlogging / 18263869522

05 Oct 2025 08:21PM UTC coverage: 84.516% (+11.0%) from 73.543%
18263869522

push

github

ollily
#1: fix github actions

24 of 36 new or added lines in 3 files covered. (66.67%)

11 existing lines in 4 files now uncovered.

262 of 310 relevant lines covered (84.52%)

13.7 hits per line

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

12.9
/src/PHPUnit/Framework/EasyGoingTestCase.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of ezlogging
7
 *
8
 * (c) 2025 Oliver Glowa, coding.glowa.com
9
 *
10
 * This source file is subject to the Apache-2.0 license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13

14
namespace PHPUnit\Framework;
15

16
use Monolog\ConsoleLogger;
17

18
abstract class EasyGoingTestCase extends TestCase
19
{
20
    /** @var \Monolog\Logger */
21
    protected $logger;
22

23
    /** @var mixed */
24
    protected $o2t;
25

26
    public function setUp(): void
2✔
27
    {
28
        parent::setUp();
2✔
29
        $this->logger = new ConsoleLogger(self::class);
2✔
30
        $this->o2t    = $this->prepareO2t();
2✔
31
    }
32

33
    /**
34
     * @return mixed
35
     */
36
    abstract protected function prepareO2t();
37

38
    /**
39
     * @return mixed
40
     */
41
    abstract protected function getCasto2t();
42

43
    /**
44
     * @param mixed[] $constants
45
     */
46
    protected function verifyConstAllExists(array $constants = []): void
×
47
    {
48
        foreach ($constants as $constant) {
×
49
            $this->verifyConstExists($constant);
×
50
        }
51
    }
52

53
    /**
54
     * @param mixed[] $constants
55
     */
56
    protected function verifyConstArrayAllExists(array $constants = []): void
×
57
    {
58
        foreach ($constants as $constant => $expectedSize) {
×
59
            $this->verifyConstExists($constant);
×
60
            $this->verifyConstArraySize($constant, $expectedSize);
×
61
        }
62
    }
63

64
    protected function verifyConstArraySize(string $constantName, int $expectedSize): void
×
65
    {
66
        $constantValue = constant($constantName);
×
67
        static::assertIsArray($constantValue);
×
68
        static::assertCount($expectedSize, $constantValue);
×
69
    }
70

71
    /**
72
     * @param string $constantName
73
     *
74
     * @SuppressWarnings("PHPMD.ElseExpression")
75
     */
76
    protected function verifyConstExists(string $constantName): void
×
77
    {
78
        if (defined($constantName)) {
×
79
            $constantValue = constant($constantName);
×
NEW
80
            $this->logger->debug("Checking '$constantName'=" . print_r($constantValue, true));
×
81
            if (!static::isPrimitive($constantValue)) {
×
82
                static::assertNotEmpty($constantValue);
×
83
            }
84
        } else {
85
            static::fail(sprintf("FAIL: Constant '%s' not exists", $constantName));
×
86
        }
87
    }
88

89
    public const LOP = 'int|integer|bool|boolean|float';
90

91
    /**
92
     * @param mixed $var
93
     *
94
     * @return bool
95
     */
UNCOV
96
    protected static function isPrimitive($var): bool
×
97
    {
98
        $primitive = false;
×
99
        if (isset($var) && strpos(self::LOP, gettype($var)) > 0) {
×
UNCOV
100
            $primitive = true;
×
101
        }
102

UNCOV
103
        return $primitive;
×
104
    }
105

UNCOV
106
    public function testInit(): void
×
107
    {
108
        static::assertNotEmpty($this->o2t);
×
109
        static::assertIsObject($this->o2t);
×
UNCOV
110
        static::assertInstanceOf(get_class($this->o2t), $this->prepareO2t());
×
111
    }
112
}
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