Skip to content

Commit

Permalink
Update PHPUnit to PHPUnit10
Browse files Browse the repository at this point in the history
  • Loading branch information
macocci7 committed Apr 18, 2024
1 parent c568e0a commit 0ec1d94
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tag_meged_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
tools: composer:v2

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
tools: composer:v2

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -63,12 +63,12 @@ jobs:
tools: composer:v2

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '14.x'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -126,25 +126,25 @@ jobs:
tools: composer:v2

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '14.x'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Composer
run: composer install --no-interaction

- name: Update PHPUnit for Code Coverage
run: composer require phpunit/phpunit:^9.6 phploc/phploc:* sebastian/version:* --with-all-dependencies
run: composer require phpunit/phpunit:^10.5 sebastian/version:* --with-all-dependencies

- name: PHP Lint
run: ./vendor/bin/parallel-lint src tests examples

- name: Unit tests
run: |
mkdir -p build/logs
./vendor/bin/phpunit ./tests/ --coverage-clover build/logs/clover.xml
XDEBUG_MODE=coverage ./vendor/bin/phpunit ./tests/ --coverage-clover build/logs/clover.xml --coverage-filter=./src/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

composer.lock
.php-version
/vendor
/.phpunit.cache
.phpunit.result.cache
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ composer require macocci7/php-boxplot
```php
<?php

require('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down Expand Up @@ -97,7 +97,7 @@ composer require macocci7/php-boxplot
- The hash keys of the data are used as the labels for the X axis.

- Details:
- Import Autoloader: `require_once('../vendor/autoload.php')`
- Import Autoloader: `require_once __DIR__ . '/../vendor/autoload.php'`
- Declare: `use Macocci7\PhpBoxplot\Boxplot`
- Instantiate: `new Boxplot()`
- Set Data: `setData($data)`
Expand All @@ -117,7 +117,7 @@ And Setting Caption can be done as follows:
```php
<?php

require('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down Expand Up @@ -202,7 +202,7 @@ Multiple datasets can be displayed side by side at the same time.
```php
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down Expand Up @@ -370,7 +370,7 @@ Second, Code PHP like this:
```php
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand All @@ -394,7 +394,7 @@ You can Adjust the Display by using Array.
```php
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down Expand Up @@ -460,7 +460,7 @@ You can set transparent background like this.
```php
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down Expand Up @@ -545,6 +545,6 @@ You can set transparent background like this.

*Document created: 2023/05/28*

*Document updated: 2024/03/09*
*Document updated: 2024/04/18*

Copyright 2023 - 2024 macocci7
2 changes: 1 addition & 1 deletion bin/TestAndLint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test_and_lint() {
echo "-----------------------------------------------------------"
echo "[PHP $1][phpunit]"
./vendor/bin/phpunit ./tests/ \
--color auto
--color=auto
echo "-----------------------------------------------------------"
}

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "macocci7/php-boxplot",
"version": "1.1.1",
"version": "1.2.0",
"description": "it's easy to use for creating boxplots.",
"type": "library",
"require": {
"intervention/image": "^3.4",
"macocci7/php-frequency-table": "1.2.0",
"php": ">=8.1",
"intervention/image": "^3.5",
"macocci7/php-frequency-table": "1.3.0",
"fakerphp/faker": "^1.22",
"nette/neon": "^3.4"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.7",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^10.5",
"phpmd/phpmd": "^2.15",
"phpstan/phpstan": "^1.10",
"phploc/phploc": "^7.0",
"php-parallel-lint/php-parallel-lint": "^1.3"
},
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion examples/AdjustDisplayByArray.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down
2 changes: 1 addition & 1 deletion examples/AdjustDisplayByMethods.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down
2 changes: 1 addition & 1 deletion examples/AdjustDisplayByNeon.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down
2 changes: 1 addition & 1 deletion examples/BasicUsage.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down
2 changes: 1 addition & 1 deletion examples/BoxplotExampleCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down
4 changes: 2 additions & 2 deletions examples/DetmersReidBoxplot2023.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Macocci7;

require('../vendor/autoload.php');
require('./class/CsvUtil.php');
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/class/CsvUtil.php';

use Macocci7\PhpBoxplot\Boxplot;
use Macocci7\CsvUtil;
Expand Down
2 changes: 1 addition & 1 deletion examples/MultipleDataSet.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down
2 changes: 1 addition & 1 deletion examples/TransparentBackground.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once('../vendor/autoload.php');
require_once __DIR__ . '/../vendor/autoload.php';

use Macocci7\PhpBoxplot\Boxplot;

Expand Down
Binary file modified examples/img/BoxplotExampleCase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<!-- 除外するルール -->
<exclude name="MissingImport" />
<exclude name="StaticAccess" />
<exclude name="ElseExpression" />
</rule>
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/controversial.xml" />
Expand Down
29 changes: 8 additions & 21 deletions tests/AnalyzerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

namespace Macocci7\PhpBoxplot;

require('vendor/autoload.php');

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Macocci7\PhpBoxplot\Analyzer;

/**
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
*/
final class AnalyzerTest extends TestCase
{
Expand All @@ -25,9 +24,7 @@ public static function provide_limit_throw_exception_with_invalid_params(): arra
];
}

/**
* @dataProvider provide_limit_throw_exception_with_invalid_params
*/
#[DataProvider('provide_limit_throw_exception_with_invalid_params')]
public function test_limit_throw_exception_with_invalid_params(int|float $lower, int|float $upper): void
{
$a = new Analyzer();
Expand All @@ -46,9 +43,7 @@ public static function provide_limit_can_set_limit_correctly(): array
];
}

/**
* @dataProvider provide_limit_can_set_limit_correctly
*/
#[DataProvider('provide_limit_can_set_limit_correctly')]
public function test_limit_can_set_limit_correctly(int|float $lower, int|float $upper): void
{
$a = new Analyzer();
Expand All @@ -75,9 +70,7 @@ public static function provide_getMean_can_get_mean_correctly(): array
];
}

/**
* @dataProvider provide_getMean_can_get_mean_correctly
*/
#[DataProvider('provide_getMean_can_get_mean_correctly')]
public function test_getMean_can_get_mean_correctly(array $data, int|float|null $expect): void
{
$bp = new Boxplot();
Expand All @@ -94,9 +87,7 @@ public static function provide_getUcl_can_get_ucl_correctly(): array
];
}

/**
* @dataProvider provide_getUcl_can_get_ucl_correctly
*/
#[DataProvider('provide_getUcl_can_get_ucl_correctly')]
public function test_getUcl_can_get_ucl_correctly(array $data, float|null $expect): void
{
$a = new Analyzer();
Expand All @@ -117,9 +108,7 @@ public static function provide_getLcl_can_get_lcl_correctly(): array
];
}

/**
* @dataProvider provide_getLcl_can_get_lcl_correctly
*/
#[DataProvider('provide_getLcl_can_get_lcl_correctly')]
public function test_getLcl_can_get_lcl_correctly(array $data, float|null $expect): void
{
$a = new Analyzer();
Expand All @@ -143,9 +132,7 @@ public static function provide_getOutliers_can_get_outliers_correctly(): array
];
}

/**
* @dataProvider provide_getOutliers_can_get_outliers_correctly
*/
#[DataProvider('provide_getOutliers_can_get_outliers_correctly')]
public function test_getOutliers_can_get_outliers_correctly(array $data, array|null $expect): void
{
$a = new Analyzer();
Expand Down
11 changes: 3 additions & 8 deletions tests/Helpers/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

namespace Macocci7\PhpBoplot\Helpers;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Macocci7\PhpBoxplot\Helpers\Config;
use Nette\Neon\Neon;

/**
* @SuppressWarnings(PHPMD.TooManyMethods)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
*/
final class ConfigTest extends TestCase
Expand Down Expand Up @@ -59,9 +58,7 @@ public static function provide_className_can_return_class_name_correctly(): arra
];
}

/**
* @dataProvider provide_className_can_return_class_name_correctly
*/
#[DataProvider('provide_className_can_return_class_name_correctly')]
public function test_className_can_return_class_name_correctly(string $class, string $expect): void
{
$this->assertSame($expect, Config::className($class));
Expand Down Expand Up @@ -91,9 +88,7 @@ public static function provide_support_object_like_keys_correctly(): array
];
}

/**
* @dataProvider provide_support_object_like_keys_correctly
*/
#[DataProvider('provide_support_object_like_keys_correctly')]
public function get_can_support_object_like_keys_correctly(string $key, array|null $expect): void
{
$this->assertSame($expect, Config::get($key));
Expand Down
Loading

0 comments on commit 0ec1d94

Please sign in to comment.