PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.5
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.5
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / rosell-dk / webp-convert / tests / CompatibleTestCase.php

CompatibleTestCase.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.5, at vendor/rosell-dk/webp-convert/tests/CompatibleTestCase.php

54 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Base TestCase which ensures that PHPUnit does not print warnings because of deprecated methods
5 *
6 * @license MIT
7 */
8
9 namespace WebPConvert\Tests;
10
11 use PHPUnit\Framework\TestCase;
12 // use PHPUnit\Runner\Version as PHPUnitVersion; // no - breaks our PHP 5.6 travis test
13
14 class CompatibleTestCase extends TestCase
15 {
16
17 // By the way:
18 // Just discovered that its possible to easily skip tests with an annotation
19 // based on criterias such as PHPUnit version or extention.
20 // See: https://phpunit.de/manual/3.7/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests-using-requires
21 // (and https://stackoverflow.com/questions/4837748/how-to-detect-version-of-phpunit)
22
23
24 public function assertDoesNotMatchRegularExpression2($arg1, $arg2)
25 {
26 // https://stackoverflow.com/questions/4837748/how-to-detect-version-of-phpunit
27 /*
28 $phpUnitVersion = PHPUnitVersion::id();
29 $phpUnitMajorVersion = explode('.', $phpUnitVersion)[0];
30 $phpUnitMinorVersion = explode('.', $phpUnitVersion)[1];
31
32 $phpUnit91OrNewer = (($phpUnitMajorVersion >=9) && ($phpUnitMinorVersion >=1));
33 */
34
35 if (method_exists(TestCase::class, 'assertDoesNotMatchRegularExpression')) {
36 $this->assertDoesNotMatchRegularExpression($arg1, $arg2);
37 } else {
38 $this->assertNotRegExp($arg1, $arg2);
39 }
40 }
41
42 public function assertMatchesRegularExpression2($arg1, $arg2)
43 {
44 // https://stackoverflow.com/questions/4837748/how-to-detect-version-of-phpunit
45
46 if (method_exists(TestCase::class, 'assertMatchesRegularExpression')) {
47 $this->assertMatchesRegularExpression($arg1, $arg2);
48 } else {
49 $this->assertRegExp($arg1, $arg2);
50 }
51 }
52
53 }
54