Skip to content

Commit

Permalink
add phpunit config file
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Jan 14, 2025
1 parent 7259a20 commit 6bdeb75
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ vendor
.idea
.DS_Store
.php-cs-fixer.cache
.phpunit.result.cache
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"squizlabs/php_codesniffer": "^3.11"
},
"scripts": {
"test": "php vendor/bin/phpunit --bootstrap tests/bootstrap.php tests/",
"check-syntax": "./bin/check-php-syntax",
"test": "vendor/bin/phpunit",
"check-syntax": "bin/check-php-syntax",
"lint": "vendor/bin/phpcs -n -s",
"fmt": "vendor/bin/phpcbf"
}
Expand Down
28 changes: 28 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://docs.phpunit.de/en/9.6/ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="true"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>

<testsuites>
<testsuite name="Koko Analytics Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

</phpunit>
9 changes: 4 additions & 5 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

// phpcs:disable PSR1.Files.SideEffects

require __DIR__ . '/../autoload.php';

define('KOKO_ANALYTICS_PLUGIN_FILE', '../koko-analytics.php');
require dirname(__DIR__) . '/koko-analytics.php';

function apply_filters($a, $b, $prio = 10, $args = 2)
{
Expand All @@ -21,14 +19,15 @@ function add_shortcode($a, $b)
}
function number_format_i18n($number, $decimals = 0)
{
return $number;
return number_format($number, $decimals);
}
function register_activation_hook($a, $b)
{
}
function update_option($a, $b, $c = false)
{
}
function get_option($a, $b, $c = false)
function get_option($a, $b = null)
{
return $b;
}

0 comments on commit 6bdeb75

Please sign in to comment.