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

codeigniter4 / CodeIgniter4 / 21568681844

01 Feb 2026 07:16PM UTC coverage: 85.41% (+1.0%) from 84.387%
21568681844

push

github

web-flow
Merge pull request #9916 from codeigniter4/4.7

4.7.0 Merge code

1603 of 1888 new or added lines in 101 files covered. (84.9%)

31 existing lines in 11 files now uncovered.

22163 of 25949 relevant lines covered (85.41%)

205.52 hits per line

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

75.0
/system/Test/Utilities/NativeHeadersStack.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Test\Utilities;
15

16
/**
17
 * A utility class for simulating native PHP header handling in unit tests.
18
 *
19
 * @internal This class is for testing purposes only.
20
 */
21
final class NativeHeadersStack
22
{
23
    /**
24
     * Simulates whether headers have been sent.
25
     */
26
    public static bool $headersSent = false;
27

28
    /**
29
     * Stores the list of headers.
30
     *
31
     * @var list<string>
32
     */
33
    public static array $headers = [];
34

35
    /**
36
     * Resets the header stack to defaults.
37
     * Call this in setUp() to ensure clean state between tests.
38
     */
39
    public static function reset(): void
40
    {
41
        self::$headersSent = false;
6✔
42
        self::$headers     = [];
6✔
43
    }
44

45
    /**
46
     * Checks if a specific header exists in the stack.
47
     *
48
     * @param string $header The exact header string (e.g., 'Content-Type: text/html')
49
     */
50
    public static function has(string $header): bool
51
    {
NEW
52
        return in_array($header, self::$headers, true);
×
53
    }
54

55
    /**
56
     * Adds a header to the stack.
57
     *
58
     * @param string $header The header to add (e.g., 'Content-Type: text/html')
59
     */
60
    public static function push(string $header): void
61
    {
62
        self::$headers[] = $header;
2✔
63
    }
64
}
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