Skip to content

Commit 77b6d0a

Browse files
committed
Repository maintenance, update dev dependencies
1 parent 0cc91da commit 77b6d0a

25 files changed

+227
-109
lines changed

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
/tests export-ignore
44
.editorconfig export-ignore
55
.gitattributes export-ignore
6+
.github/ export-ignore
67
.gitignore export-ignore
7-
.php_cs export-ignore
8-
.travis.yml export-ignore
8+
.php-cs-fixer.php export-ignore
99
CHANGELOG.md export-ignore
1010
CONTRIBUTING.md export-ignore
1111
LICENSE.md export-ignore

.github/workflows/CodingStyles.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Coding Styles
2+
3+
on: push
4+
5+
jobs:
6+
tests:
7+
name: Coding Styles
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
fail-fast: true
12+
matrix:
13+
php:
14+
- "7.4"
15+
- "8.0"
16+
- "8.1"
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Install PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: "${{ matrix.php }}"
26+
27+
- name: Install Composer dependencies
28+
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
29+
30+
- name: Coding styles
31+
run: composer run-script cs-lint

.github/workflows/Test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test
2+
3+
on: push
4+
5+
jobs:
6+
test:
7+
name: "PHPUnit (PHP ${{ matrix.php }})"
8+
runs-on: "ubuntu-20.04"
9+
10+
strategy:
11+
matrix:
12+
php:
13+
- "7.4"
14+
- "8.0"
15+
- "8.1"
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Install PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: "${{ matrix.php }}"
25+
26+
- name: Install Composer dependencies
27+
run: composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
28+
29+
- name: Tests
30+
run: composer run-script test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.php_cs.cache
22
vendor
33
composer.lock
4+
.phpunit.result.cache

.php_cs renamed to .php-cs-fixer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
->in(__DIR__);
88

99
$rules = [
10-
'psr0' => false,
10+
'psr_autoloading' => false,
1111
'@PSR2' => true,
1212
'phpdoc_order' => true,
1313
'ordered_imports' => true,
1414
];
1515

16-
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
16+
$cacheDir = getenv('HOME') ? getenv('HOME') : __DIR__;
1717

18-
return Config::create()
19-
->setRules($rules)
20-
->setFinder($finder)
21-
->setCacheFile($cacheDir . '/.php_cs.cache');
18+
$config = new Config();
2219

20+
return $config->setRules($rules)
21+
->setFinder($finder)
22+
->setCacheFile($cacheDir . '/.php-cs-fixer.cache');

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### v4.0.0
2+
* Dropped support for unsupported PHP versions
3+
14
### v3.0.2
25
* Fixed issue with top level remove contributed by [@digitalkaoz](https://github.com/digitalkaoz)
36

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JSON Patch for PHP
22

3-
[![Build Status](https://secure.travis-ci.org/raphaelstolt/php-jsonpatch.png)](http://travis-ci.org/raphaelstolt/php-jsonpatch) [![Version](http://img.shields.io/packagist/v/php-jsonpatch/php-jsonpatch.svg?style=flat)](https://packagist.org/packages/php-jsonpatch/php-jsonpatch) [![PHP Version](https://img.shields.io/badge/php-7.2+-ff69b4.svg)](https://packagist.org/packages/php-jsonpatch/php-jsonpatch)
3+
![Test](https://github.com/raphaelstolt/php-jsonpatch/workflows/Test/badge.svg) [![Version](http://img.shields.io/packagist/v/php-jsonpatch/php-jsonpatch.svg?style=flat)](https://packagist.org/packages/php-jsonpatch/php-jsonpatch) [![PHP Version](https://img.shields.io/badge/php-7.4+-ff69b4.svg)](https://packagist.org/packages/php-jsonpatch/php-jsonpatch)
44

55
This is an implementation of [JSON Patch](http://tools.ietf.org/html/rfc6902) written in PHP.
66

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
"issues": "https://github.com/raphaelstolt/php-jsonpatch/issues"
1717
},
1818
"require": {
19-
"php": ">=7.2",
20-
"symfony/polyfill-mbstring": "^1.1",
21-
"php-jsonpointer/php-jsonpointer": "^3.0"
19+
"php": ">=7.4",
20+
"symfony/polyfill-mbstring": "^1.2",
21+
"php-jsonpointer/php-jsonpointer": "^4.0"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "4.6.*",
25-
"friendsofphp/php-cs-fixer": "^2.0"
24+
"phpunit/phpunit": "8.*",
25+
"friendsofphp/php-cs-fixer": "^3.0"
2626
},
2727
"autoload": {
2828
"psr-0": {

phpunit.xml.dist

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
convertNoticesToExceptions="true"
77
convertWarningsToExceptions="true"
88
processIsolation="false"
9-
stopOnFailure="true"
10-
syntaxCheck="false">
11-
<testsuites for="Json Patch">
9+
stopOnFailure="true">
10+
<testsuites>
1211
<testsuite name="unit">
1312
<directory>tests/unit/</directory>
1413
</testsuite>

tests/integration/Rs/Json/PatchAddTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace Rs\Json;
33

4+
use PHPUnit\Framework\TestCase;
45
use Rs\Json\Patch;
56

6-
class PatchAddTest extends \PHPUnit_Framework_TestCase
7+
class PatchAddTest extends TestCase
78
{
89
/**
910
* @test

tests/integration/Rs/Json/PatchCopyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace Rs\Json;
33

4+
use PHPUnit\Framework\TestCase;
45
use Rs\Json\Patch;
56

6-
class PatchCopyTest extends \PHPUnit_Framework_TestCase
7+
class PatchCopyTest extends TestCase
78
{
89
/**
910
* @test

tests/integration/Rs/Json/PatchMoveTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace Rs\Json;
33

4+
use PHPUnit\Framework\TestCase;
45
use Rs\Json\Patch;
56

6-
class PatchMoveTest extends \PHPUnit_Framework_TestCase
7+
class PatchMoveTest extends TestCase
78
{
89
/**
910
* @test

tests/integration/Rs/Json/PatchRemoveTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace Rs\Json;
33

4+
use PHPUnit\Framework\TestCase;
45
use Rs\Json\Patch;
56

6-
class PatchRemoveTest extends \PHPUnit_Framework_TestCase
7+
class PatchRemoveTest extends TestCase
78
{
89
/**
910
* @return array

tests/integration/Rs/Json/PatchReplaceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace Rs\Json;
33

4+
use PHPUnit\Framework\TestCase;
45
use Rs\Json\Patch;
56

6-
class PatchReplaceTest extends \PHPUnit_Framework_TestCase
7+
class PatchReplaceTest extends TestCase
78
{
89
/**
910
* @test

tests/integration/Rs/Json/PatchTestTest.php

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<?php
22
namespace Rs\Json;
33

4+
use PHPUnit\Framework\TestCase;
45
use Rs\Json\Patch;
6+
use Rs\Json\Patch\FailedTestException;
7+
use Rs\Json\Pointer\InvalidPointerException;
58

6-
class PatchTestTest extends \PHPUnit_Framework_TestCase
9+
class PatchTestTest extends TestCase
710
{
811
/**
912
* @test
10-
* @expectedException Rs\Json\Patch\FailedTestException
11-
* @expectedExceptionMessage Failed on Test PatchOperation at index:
1213
*/
1314
public function shouldThrowFailedTestExceptionWhenTestFails()
1415
{
16+
$this->expectException(FailedTestException::class);
17+
$this->expectExceptionMessage('Failed on Test PatchOperation at index:');
18+
1519
$expectedDocument = $targetDocument = '{"foo":"bar"}';
1620
$patchDocument = '[
1721
{"op":"test", "path":"/baz", "value":"qux"},
@@ -26,13 +30,15 @@ public function shouldThrowFailedTestExceptionWhenTestFails()
2630
$patchedDocument
2731
);
2832
}
33+
2934
/**
3035
* @test
31-
* @expectedException Rs\Json\Patch\FailedTestException
32-
* @expectedExceptionMessage Failed on Test PatchOperation at index:
3336
*/
3437
public function shouldThrowFailedTestExceptionWhenTestFailsForPriorPatch()
3538
{
39+
$this->expectException(FailedTestException::class);
40+
$this->expectExceptionMessage('Failed on Test PatchOperation at index:');
41+
3642
$expectedDocument = $targetDocument = '{"a":{"b":{"c": 100}}}';
3743
$patchDocument = '[
3844
{"op":"replace", "path":"/a/b/c", "value":42 },
@@ -47,13 +53,15 @@ public function shouldThrowFailedTestExceptionWhenTestFailsForPriorPatch()
4753
$patchedDocument
4854
);
4955
}
56+
5057
/**
5158
* @test
52-
* @expectedException Rs\Json\Patch\FailedTestException
53-
* @expectedExceptionMessage Failed on Test PatchOperation at index:
5459
*/
5560
public function shouldThrowFailedTestExceptionWhenUsingPointerEscapes()
5661
{
62+
$this->expectException(FailedTestException::class);
63+
$this->expectExceptionMessage('Failed on Test PatchOperation at index:');
64+
5765
$expectedDocument = $targetDocument = '{"/": 9, " ~1": 10}';
5866
$patchDocument = '[ {"op":"test", "path":"/~01", "value": 10} ]';
5967

@@ -67,11 +75,12 @@ public function shouldThrowFailedTestExceptionWhenUsingPointerEscapes()
6775
}
6876
/**
6977
* @test
70-
* @expectedException Rs\Json\Patch\FailedTestException
71-
* @expectedExceptionMessage Failed on Test PatchOperation at index:
7278
*/
7379
public function shouldThrowFailedTestExceptionWhenTestFailsForUnsuccessfulComparison()
7480
{
81+
$this->expectException(FailedTestException::class);
82+
$this->expectExceptionMessage('Failed on Test PatchOperation at index:');
83+
7584
$expectedDocument = $targetDocument = '{"/": 9, " ~1": 10}';
7685
$patchDocument = '[ {"op":"test", "path":"/~01", "value":"10"} ]';
7786

@@ -83,6 +92,7 @@ public function shouldThrowFailedTestExceptionWhenTestFailsForUnsuccessfulCompar
8392
$patchedDocument
8493
);
8594
}
95+
8696
/**
8797
* @test
8898
* @ticket 8 (https://github.com/raphaelstolt/php-jsonpatch/issues/8)
@@ -100,13 +110,15 @@ public function shouldDoASuccessfulTestComparison()
100110
$patchedDocument
101111
);
102112
}
113+
103114
/**
104115
* @test
105-
* @expectedException Rs\Json\Pointer\InvalidPointerException
106-
* @expectedExceptionMessage Pointer starts with invalid character
107116
*/
108117
public function shouldThrowExceptionOnUsageOfUriFragmentIdentifierInPatch()
109118
{
119+
$this->expectException(InvalidPointerException::class);
120+
$this->expectExceptionMessage('Pointer starts with invalid character');
121+
110122
$targetDocument = '{"foo":"bar"}';
111123
$patchDocument = '[{"op":"add", "path":"#/baz", "value":[1,2,3]}]';
112124
$expectedDocument = '{"foo":"bar","baz":[1,2,3]}';

0 commit comments

Comments
 (0)