Skip to content

Commit 6bdeb75

Browse files
add phpunit config file
1 parent 7259a20 commit 6bdeb75

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ vendor
44
.idea
55
.DS_Store
66
.php-cs-fixer.cache
7+
.phpunit.result.cache

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"squizlabs/php_codesniffer": "^3.11"
2626
},
2727
"scripts": {
28-
"test": "php vendor/bin/phpunit --bootstrap tests/bootstrap.php tests/",
29-
"check-syntax": "./bin/check-php-syntax",
28+
"test": "vendor/bin/phpunit",
29+
"check-syntax": "bin/check-php-syntax",
3030
"lint": "vendor/bin/phpcs -n -s",
3131
"fmt": "vendor/bin/phpcbf"
3232
}

phpunit.xml.dist

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- https://docs.phpunit.de/en/9.6/ -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
colors="true"
7+
bootstrap="tests/bootstrap.php"
8+
convertDeprecationsToExceptions="true"
9+
>
10+
<php>
11+
<ini name="display_errors" value="1" />
12+
<ini name="error_reporting" value="-1" />
13+
<server name="SHELL_VERBOSITY" value="-1" />
14+
</php>
15+
16+
<testsuites>
17+
<testsuite name="Koko Analytics Test Suite">
18+
<directory>tests</directory>
19+
</testsuite>
20+
</testsuites>
21+
22+
<coverage processUncoveredFiles="true">
23+
<include>
24+
<directory suffix=".php">src</directory>
25+
</include>
26+
</coverage>
27+
28+
</phpunit>

tests/bootstrap.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
// phpcs:disable PSR1.Files.SideEffects
44

5-
require __DIR__ . '/../autoload.php';
6-
7-
define('KOKO_ANALYTICS_PLUGIN_FILE', '../koko-analytics.php');
5+
require dirname(__DIR__) . '/koko-analytics.php';
86

97
function apply_filters($a, $b, $prio = 10, $args = 2)
108
{
@@ -21,14 +19,15 @@ function add_shortcode($a, $b)
2119
}
2220
function number_format_i18n($number, $decimals = 0)
2321
{
24-
return $number;
22+
return number_format($number, $decimals);
2523
}
2624
function register_activation_hook($a, $b)
2725
{
2826
}
2927
function update_option($a, $b, $c = false)
3028
{
3129
}
32-
function get_option($a, $b, $c = false)
30+
function get_option($a, $b = null)
3331
{
32+
return $b;
3433
}

0 commit comments

Comments
 (0)