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

Added CI unit and integration tests #4

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c8cc40c
Added CI unit and integration tests
Screenfeed May 6, 2021
a360c9d
Fixed the "A mapping was not expected" error
Screenfeed May 6, 2021
d8e281f
Fixed the missing operating system
Screenfeed May 6, 2021
240d8eb
Added missing slash to WP_CORE_DIR
Screenfeed May 6, 2021
1040a0e
Use only php 7.2 and 7.4, load mysql differently
Screenfeed May 6, 2021
50bad5b
Updated composer.lock
Screenfeed May 6, 2021
6c80b5f
Use only ubuntu
Screenfeed May 6, 2021
4a755ff
Try WP 4.4.1 instead of 4.4
Screenfeed May 6, 2021
63b5561
sdfg
Screenfeed May 6, 2021
a303afe
Added class alias for old WP versions
Screenfeed May 6, 2021
04db51f
Doh!
Screenfeed May 6, 2021
7cb6687
if
Screenfeed May 6, 2021
de98418
qerg
Screenfeed May 6, 2021
a7a8e73
serth
Screenfeed May 6, 2021
ad7cd75
serhgfdgh
Screenfeed May 6, 2021
2c8360a
Com'on!
Screenfeed May 6, 2021
60aed02
Let's go berserk
Screenfeed May 6, 2021
3d9f721
Uh?
Screenfeed May 6, 2021
23d6338
Tsss...
Screenfeed May 6, 2021
01eda94
srthdjh
Screenfeed May 6, 2021
1450b1d
getenv
Screenfeed May 6, 2021
9ece92f
raw
Screenfeed May 6, 2021
d90d7bc
This is doomed, but trying something
Screenfeed May 6, 2021
93dbb9c
For fun
Screenfeed May 6, 2021
e06f750
srtght
Screenfeed May 6, 2021
80af2c4
sehtsrth
Screenfeed May 6, 2021
38dcade
Replaced WP 4.4 by 5.1
Screenfeed May 7, 2021
a171054
Trying something (this will probably explode)
Screenfeed May 7, 2021
0406996
Nop, nobody saw this
Screenfeed May 7, 2021
6c17ae8
Let's try this
Screenfeed May 7, 2021
74ebbc3
prefer-lowest
Screenfeed May 7, 2021
e71ea74
prefer-lowest + remove
Screenfeed May 7, 2021
99bbd73
hgsrtr
Screenfeed May 7, 2021
97b71cd
edgrsdgs
Screenfeed May 7, 2021
7ff90e5
Let's go dirty
Screenfeed May 7, 2021
a999ccc
sdfghsrhdr
Screenfeed May 7, 2021
53d0e13
Bye-bye php 5.4
Screenfeed May 10, 2021
0d39c1d
Try other OS
Screenfeed May 10, 2021
30b9c4b
No other OS then
Screenfeed May 10, 2021
4aba560
No need to test with WP 5.2
Screenfeed May 10, 2021
1602597
Try php 8.0
Screenfeed May 10, 2021
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
81 changes: 81 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Unit/Integration tests

on:
pull_request:
branches:
- main
- branch-*
- tool-*

jobs:
run:
runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.1', '7.4']
wp-versions: ['5.1', 'latest']

include:
- operating-system: ubuntu-latest
php-versions: '8.0'
wp-versions: 'latest'
composer-options: --ignore-platform-reqs

services:
database:
image: mysql:5.6
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5

name: WP ${{ matrix.wp-versions }} with PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}.

env:
WP_TESTS_DIR: "/tmp/tests/phpunit"
WP_CORE_DIR: "/tmp/wordpress-develop/"

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
tools: composer:v1, phpunit, cs2pr
extensions: mysql

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Validate composer.json and composer.lock
run: composer validate

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest --no-interaction ${{ matrix.composer-options }}

- name: Install tests
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }}

- name: Run test
run: composer run-tests
2 changes: 1 addition & 1 deletion Tests/Unit/.phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":234:{a:2:{s:7:"defects";a:1:{s:81:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Init::testShouldRegisterHook";i:4;}s:5:"times";a:1:{s:81:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Init::testShouldRegisterHook";d:0.318;}}}
C:37:"PHPUnit\Runner\DefaultTestResultCache":4922:{a:2:{s:7:"defects";a:1:{s:81:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Init::testShouldRegisterHook";i:4;}s:5:"times";a:40:{s:81:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Init::testShouldRegisterHook";d:0.147;s:92:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Delete::testShouldDeleteOnlyValidValues";d:0.208;s:83:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Delete::testShouldDeleteOption";d:0;s:80:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Delete::testShouldNotDelete";d:0.001;s:83:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_DeleteAll::testShouldDeleteAll";d:0.001;s:97:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Get::testShouldReturnNullWhenNotStringOption";d:0.001;s:94:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Get::testShouldReturnNullWhenUnkownOption";d:0;s:79:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Get::testShouldReturnValue";d:0.014;s:88:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_GetAll::testShouldReturnResetValues";d:0;s:83:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_GetAll::testShouldReturnValues";d:0;s:92:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_GetAll::testShouldReturnOnlyValidValues";d:0;s:88:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_GetStorage::testShouldReturnStorage";d:0;s:82:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Has::testShouldReturnIfHasKey";d:0;s:86:"Screenfeed\AutoWPOptions\Tests\Unit\src\Options\Test_Set::testShouldSetOnlyValidValues";d:0.001;s:126:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_GetDefaultValues::testShouldReturnDefaultValues";d:0.013;s:120:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_GetIdentifier::testShouldReturnIdentifier";d:0.003;s:112:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_GetPrefix::testShouldReturnPrefix";d:0;s:122:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_GetResetValues::testShouldReturnResetValues";d:0.001;s:128:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_SanitizeAndValidate::testShouldReturnDefaultValue";d:0.007;s:132:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_SanitizeAndValidate::testShouldReturnSanitizedVersion";d:0.001;s:130:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_SanitizeAndValidate::testShouldReturnSanitizedValue";d:0.001;s:139:"Screenfeed\AutoWPOptions\Tests\Unit\src\Sanitization\AbstractSanitization\Test_SanitizeAndValidateOnUpdate::testShouldReturnValidatedValues";d:0.005;s:118:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Delete::testShouldDeleteNetworkOptionWhenIsNetworkOption";d:0.004;s:118:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Delete::testShouldDeleteSiteOptionWhenIsNotNetworkOption";d:0.001;s:111:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Get::testShouldReturnAnEmptyArrayWhenInvalidValue";d:0.002;s:104:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Get::testShouldReturnFalseWhenValueIsFalse";d:0.001;s:104:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Get::testShouldReturnAnArrayWhenValidValue";d:0.001;s:115:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Get::testShouldReturnNetworkOptionWhenIsNetworkOption";d:0.001;s:98:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_GetFullName::testShouldReturnAString";d:0;s:101:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_GetFullName::testShouldReturnOptionName";d:0;s:101:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_GetNetworkId::testShouldReturnAnInteger";d:0.004;s:108:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_GetNetworkId::testShouldReturnCurrentNetworkId";d:0.001;s:106:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_GetNetworkId::testShouldReturnGivenNetworkId";d:0;s:91:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_GetType::testShouldReturnType";d:0;s:103:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_IsNetworkOption::testShouldReturnABoolean";d:0;s:110:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_IsNetworkOption::testShouldReturnIfNetworkOption";d:0;s:103:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Set::testShouldDeleteOptionWhenEmptyValue";d:0.002;s:115:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Set::testShouldUpdateNetworkOptionWhenIsNetworkOption";d:0.001;s:125:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Set::testShouldUpdateAutoloadedSiteOptionWhenIsNotNetworkOption";d:0.003;s:128:"Screenfeed\AutoWPOptions\Tests\Unit\src\Storage\WpOption\Test_Set::testShouldUpdateNonAutoloadedSiteOptionWhenIsNotNetworkOption";d:0.001;}}}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"php": ">=5.4.0"
},
"require-dev": {
"php": "^7.1",
"php": ">=7.1",
"automattic/phpcs-neutron-standard": "*",
"brain/monkey": "^2.0",
"dealerdirect/phpcodesniffer-composer-installer": "*",
Expand Down
45 changes: 25 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.