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

The-oGlow / ezlogging / 17212828779

25 Aug 2025 03:09PM UTC coverage: 81.865% (-0.2%) from 82.105%
17212828779

push

github

ollily
update analysis workflow

11 of 13 new or added lines in 8 files covered. (84.62%)

158 of 193 relevant lines covered (81.87%)

6.96 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
    /** @var mixed */
23
    protected $o2t;
24

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

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

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

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

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

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

68
    protected function verifyConstExists(string $constantName): void
×
69
    {
70
        if (defined($constantName))
×
71
        {
72
            $constantValue = constant($constantName);
×
73
            $this->logger->debug("Checking '$constantName'=" . var_export($constantValue, true));
×
74
            if (!static::is_primitive($constantValue))
×
75
            {
76
                static::assertNotEmpty($constantValue);
×
77
            }
78
        } else
79
        {
80
            static::fail(sprintf("FAIL: Constant '%s' not exists", $constantName));
×
81
        }
82
    }
83

84
    public const LOP = 'int|integer|bool|boolean|float';
85

86
    /**
87
     * @param mixed $var
88
     *
89
     * @return bool
90
     */
91
    protected static function is_primitive($var): bool
×
92
    {
93
        $primitive = false;
×
94
        if (isset($var) && strpos(self::LOP, gettype($var)) > 0)
×
95
        {
96
            $primitive = true;
×
97
        }
98

99
        return $primitive;
×
100
    }
101

102
    public function testInit(): void
×
103
    {
104
        static::assertNotEmpty($this->o2t);
×
NEW
105
        static::assertIsObject($this->o2t);
×
NEW
106
        static::assertInstanceOf(get_class($this->o2t), $this->prepareO2t());
×
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

© 2026 Coveralls, Inc