Skip to content

Commit e0b921a

Browse files
authored
adds github actions to run tests and upgrades to php>=7.1 and phpunit^=9.5
1 parent 4648ef6 commit e0b921a

File tree

7 files changed

+65
-40
lines changed

7 files changed

+65
-40
lines changed

.github/workflows/phpunit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PHPUnit
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Validate composer.json and composer.lock
18+
run: composer validate --strict
19+
20+
- name: Cache Composer packages
21+
id: composer-cache
22+
uses: actions/cache@v2
23+
with:
24+
path: vendor
25+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-php-
28+
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-progress
31+
32+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
33+
# Docs: https://getcomposer.org/doc/articles/scripts.md
34+
35+
- name: Run test suite
36+
run: composer run-script test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.idea/
22
/vendor/
33

4+
.phpunit.result.cache
45
composer.lock
56
phpunit.xml

.travis.yml

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

composer.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,28 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.0"
13+
"php": ">=7.1"
1414
},
1515
"autoload": {
1616
"psr-4": {
1717
"MadeSimple\\Arrays\\": "src/"
1818
}
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^6.3"
21+
"phpunit/phpunit": "^9.5"
2222
},
2323
"autoload-dev": {
2424
"psr-4": {
2525
"MadeSimple\\Arrays\\Test\\": "tests/"
2626
}
27+
},
28+
"config": {
29+
"sort-packages": true
30+
},
31+
"scripts": {
32+
"test": "vendor/bin/phpunit"
33+
},
34+
"scripts-descriptions": {
35+
"test": "Run unit and integration tests"
2736
}
2837
}

phpunit.xml.dist

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true">
6+
<coverage>
7+
<include>
8+
<directory>src/</directory>
9+
</include>
10+
</coverage>
11+
<testsuites>
12+
<testsuite name="Test Suite">
13+
<directory>tests/</directory>
14+
</testsuite>
15+
</testsuites>
16+
</phpunit>

phpunit.xml.example

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

tests/Unit/ArrTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public function testLocateOnPropertyNotFound()
466466
['sub' => ['locator' => '3c', 'description' => 'gamma']],
467467
];
468468

469-
$this->assertNull(Arr::locate($shallow, 'invalid_property', '1a')['description']);
469+
$this->assertNull(Arr::locate($shallow, 'invalid_property', '1a'));
470470
}
471471

472472
public function testLocate()

0 commit comments

Comments
 (0)