Skip to content

Commit

Permalink
Merge pull request #294 from bigcommerce/phpmnt-69-upgrade-phpunit
Browse files Browse the repository at this point in the history
Upgrade php & phpunit
  • Loading branch information
funivan committed Jan 16, 2024
2 parents 68ccc74 + df5703b commit e9c6905
Show file tree
Hide file tree
Showing 37 changed files with 329 additions and 470 deletions.
27 changes: 22 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,35 @@ orbs:
ci: bigcommerce/internal@volatile
php: bigcommerce/internal-php@volatile

default_matrix: &default_matrix
define: &php_min "8.1"

jobs_default: &jobs_default
e:
name: php/php
php-version: << matrix.php-version >>
matrix:
parameters:
php-version: [ "8.0", "8.1", "8.2" ]
php-version: [ *php_min, "8.2" ]

jobs:
cs-fixer:
executor:
name: php/php
php-version: *php_min
steps:
- ci/pre-setup
- php/composer-install
- run: ./vendor/bin/php-cs-fixer fix --diff --dry-run -v

workflows:
version: 2
full:
jobs:
- php/phpunit-tests:
<<: *default_matrix
configuration: "phpunit.xml.dist"
<<: *jobs_default
minimum_coverage: 60
- php/static-analysis:
<<: *default_matrix
<<: *jobs_default
generate_ide_helper: false
- cs-fixer

4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ composer.lock
script/*

# Testing
/phpunit.xml
/build
/test/reports
.env
.idea
/.php_cs
/.php_cs.cache
/.phpunit.result.cache
/*.cache
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
return (new PhpCsFixer\Config())
->setFinder(
PhpCsFixer\Finder::create()
->files()
->in(__DIR__)
->name("*.php")
->ignoreVCSIgnored(true)
)
->setRules([
'@PSR2' => true,
]);
11 changes: 0 additions & 11 deletions .php_cs.dist

This file was deleted.

7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
}
],
"require": {
"php": ">=8.0",
"php": ">=8.1",
"firebase/php-jwt": "~5.0 || ~6.0",
"ext-curl": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.13",
"php-coveralls/php-coveralls": "2.5",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.10"
"phpunit/phpunit": "^10.0",
"phpstan/phpstan": "^1.10",
"rector/rector": "^0.19.0"
},
"autoload": {
"psr-0": {
Expand Down
10 changes: 6 additions & 4 deletions phpunit.xml.dist → phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="true" backupStaticAttributes="true" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" forceCoversAnnotation="false" processIsolation="false" bootstrap="vendor/autoload.php">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="true" colors="true" bootstrap="vendor/autoload.php" cacheDirectory=".phpunit.cache" backupStaticProperties="true" requireCoverageMetadata="false">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="test/reports/coverage/"/>
Expand All @@ -19,4 +16,9 @@
<directory>test/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
15 changes: 15 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([__DIR__ . '/test']);
$rectorConfig->sets([
PHPUnitSetList::PHPUNIT_100
]);
};
4 changes: 3 additions & 1 deletion src/Bigcommerce/Api/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ public function getHeaders()
*/
public function __destruct()
{
curl_close($this->curl);
if ($this->curl !== null) {
curl_close($this->curl);
}
}
}
Loading

0 comments on commit e9c6905

Please sign in to comment.