Skip to content
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
4 changes: 1 addition & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
.github export-ignore
bin export-ignore
Tests export-ignore
vendor export-ignore

.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
composer.lock export-ignore
LICENSE export-ignore
phpcs.xml export-ignore
phpcs.xml.dist export-ignore
phpstan.neon.dist export-ignore
README.md export-ignore
36 changes: 0 additions & 36 deletions .github/workflows/lint_phpcs.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/lint_phpstan.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PHP CodeSniffer

on:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancel all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
phpcs:
uses: wp-media/workflows/.github/workflows/phpcs.yml@main
15 changes: 15 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PHPStan

on:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancel all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
phpstan:
uses: wp-media/workflows/.github/workflows/phpstan.yml@main
51 changes: 51 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PHPUnit

on:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancel all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
run:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: 'memory_limit=1G'
coverage: none
tools: cs2pr

- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

- name: Install SVN
run: sudo apt-get install subversion

- name: Start mysql service
run: sudo /etc/init.d/mysql start

- name: Install tests
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 latest

- name: Mysql8 auth plugin workaround
run: sudo mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"

- name: Run PHPUnit unit tests
run: composer test-unit

- name: Run PHPUnit integration tests
run: composer test-integration
67 changes: 0 additions & 67 deletions .github/workflows/tests.yml

This file was deleted.

70 changes: 0 additions & 70 deletions .github/workflows/tests_legacy.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor/*
composer.lock
.phpunit.result.cache
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'test_data' => [
'testShouldReturnEmptyArray' => [
'testShouldReturnEmptyArray' => [
'option' => [],
],
'testShouldReturnArrayWithData' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

return [
'test_data' => [
'testShouldReturnFilteredValueWhenPreFiltering' => [
'option' => [
'testShouldReturnFilteredValueWhenPreFiltering' => [
'option' => [
'foo' => 'bar',
'test' => 0,
'rocket' => 'no',
Expand All @@ -17,7 +17,7 @@
'expected' => 'yes',
],
'testShouldReturnValueWhenExistsAndNoPrefiltering' => [
'option' => [
'option' => [
'foo' => 'bar',
'test' => 0,
'rocket' => 'no',
Expand All @@ -29,8 +29,8 @@
],
'expected' => 'no',
],
'testShouldReturnDefaultWhenKeyDoesntExist' => [
'option' => [
'testShouldReturnDefaultWhenKeyDoesntExist' => [
'option' => [
'foo' => 'bar',
'test' => 0,
'rocket' => 'no',
Expand All @@ -42,8 +42,8 @@
],
'expected' => 'default',
],
'testShouldReturnFilteredValueWhenPostFiltering' => [
'option' => [
'testShouldReturnFilteredValueWhenPostFiltering' => [
'option' => [
'foo' => 'bar',
'test' => 0,
'rocket' => 'no',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
'key' => 'foobar',
'expected' => false,
],
'testShouldReturnTrueWhenArrayHasKey' => [
'testShouldReturnTrueWhenArrayHasKey' => [
'option' => [
'test' => 'value',
'foobar' => 'foo'
'foobar' => 'foo',
],
'key' => 'foobar',
'expected' => true,
Expand Down
Loading