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

Yoast / PHPUnit-Polyfills / 12771414153

14 Jan 2025 03:53PM UTC coverage: 83.706% (-13.9%) from 97.628%
12771414153

push

github

jrfnl
Drop support for PHPUnit < 7.5 [1]

Adjust CI, README and `composer.json` for the drop of support for PHPUnit < 7.5.0.

The 7.5.0 version is a deliberate choice to allow for dropping all PHPUnit 7.x related polyfills.

637 of 761 relevant lines covered (83.71%)

120.71 hits per line

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

0.0
/src/Polyfills/AssertStringContains.php
1
<?php
2

3
namespace Yoast\PHPUnitPolyfills\Polyfills;
4

5
/**
6
 * Polyfill the Assert::assertStringContainsString() et al methods, which replace the use of
7
 * Assert::assertContains() and Assert::assertNotContains() with string haystacks.
8
 *
9
 * Introduced in PHPUnit 7.5.0.
10
 * Use of Assert::assertContains() and Assert::assertNotContains() with string haystacks was
11
 * deprecated in PHPUnit 7.5.0 and removed in PHPUnit 9.0.0.
12
 *
13
 * @link https://github.com/sebastianbergmann/phpunit/issues/3422
14
 * @link https://github.com/sebastianbergmann/phpunit/issues/2520
15
 * @link https://github.com/sebastianbergmann/phpunit/pull/2778
16
 *
17
 * @since 0.1.0
18
 */
19
trait AssertStringContains {
20

21
        /**
22
         * Asserts that a string haystack contains a needle.
23
         *
24
         * @param string $needle   The string to search for.
25
         * @param string $haystack The string to treat as the haystack.
26
         * @param string $message  Optional failure message to display.
27
         *
28
         * @return void
29
         */
30
        final public static function assertStringContainsString( $needle, $haystack, $message = '' ) {
×
31
                static::assertContains( $needle, $haystack, $message );
×
32
        }
33

34
        /**
35
         * Asserts that a string haystack contains a needle (case-insensitive).
36
         *
37
         * @param string $needle   The string to search for.
38
         * @param string $haystack The string to treat as the haystack.
39
         * @param string $message  Optional failure message to display.
40
         *
41
         * @return void
42
         */
43
        final public static function assertStringContainsStringIgnoringCase( $needle, $haystack, $message = '' ) {
×
44
                static::assertContains( $needle, $haystack, $message, true );
×
45
        }
46

47
        /**
48
         * Asserts that a string haystack does NOT contain a needle.
49
         *
50
         * @param string $needle   The string to search for.
51
         * @param string $haystack The string to treat as the haystack.
52
         * @param string $message  Optional failure message to display.
53
         *
54
         * @return void
55
         */
56
        final public static function assertStringNotContainsString( $needle, $haystack, $message = '' ) {
×
57
                static::assertNotContains( $needle, $haystack, $message );
×
58
        }
59

60
        /**
61
         * Asserts that a string haystack does NOT contain a needle (case-insensitive).
62
         *
63
         * @param string $needle   The string to search for.
64
         * @param string $haystack The string to treat as the haystack.
65
         * @param string $message  Optional failure message to display.
66
         *
67
         * @return void
68
         */
69
        final public static function assertStringNotContainsStringIgnoringCase( $needle, $haystack, $message = '' ) {
×
70
                static::assertNotContains( $needle, $haystack, $message, true );
×
71
        }
72
}
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