Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade php & phpunit #294

Merged
merged 9 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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