Skip to content

Commit e9ca00d

Browse files
authored
Merge pull request #1 from alleyinteractive/1.0
Add initial functionality and tests
2 parents 5af9402 + 79a3247 commit e9ca00d

38 files changed

+4215
-0
lines changed

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# EditorConfig helps maintain consistent coding styles for developers working on the same project across various editors and IDEs.
2+
# See https://editorconfig.org.
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.php]
13+
indent_style = tab
14+
indent_size = 4;
15+
16+
[*.xml]
17+
indent_style = space
18+
indent_size = 4
19+
20+
[*.json]
21+
indent_style = space
22+
indent_size = 2
23+
24+
[*.yml]
25+
indent_style = space
26+
indent_size = 2

.gitattributes

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Exclude these files from release archives.
3+
#
4+
# This will also make the files unavailable when using Composer with `--prefer-dist`.
5+
# If you develop using Composer, use `--prefer-source`.
6+
#
7+
# Via WPCS.
8+
#
9+
/.github export-ignore
10+
/.php-cs-fixer.dist.php export-ignore
11+
/phpcs.xml export-ignore
12+
/phpunit.xml export-ignore
13+
/tests export-ignore
14+
15+
#
16+
# Auto detect text files and perform LF normalization.
17+
#
18+
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
19+
#
20+
* text=auto
21+
22+
#
23+
# The above will handle all files not found below.
24+
#
25+
*.md text
26+
*.php text
27+
*.inc text

.github/pull_request_template.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Summary
2+
3+
As titled.
4+
5+
## Notes for reviewers
6+
7+
None.
8+
9+
## Changelog entries
10+
11+
### Added
12+
13+
### Changed
14+
15+
### Deprecated
16+
17+
### Removed
18+
19+
### Fixed
20+
21+
### Security

.github/workflows/cs.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Coding Standards
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
cs:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
php: [ 7.4 ]
13+
steps:
14+
- name: Cancel previous runs of this workflow (pull requests only)
15+
if: ${{ github.event_name == 'pull_request' }}
16+
uses: styfle/[email protected]
17+
with:
18+
access_token: ${{ github.token }}
19+
20+
- name: Check out code
21+
uses: actions/checkout@v3
22+
23+
- name: Set up PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php }}
27+
28+
- name: Install composer dependencies
29+
uses: ramsey/composer-install@v2
30+
31+
- name: Run PHPCS
32+
run: composer run-script phpcs
33+
34+
- name: Run PHP-CS-Fixer
35+
run: vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no --allow-risky=yes

.github/workflows/tests.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
phpunit:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
php: [ 8.1, 8.0, 7.4 ]
13+
wp_version: [ "latest" ]
14+
can_fail: [ false ]
15+
multisite: [ 0,1 ]
16+
services:
17+
mysql:
18+
image: mysql:5.7
19+
env:
20+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
21+
ports:
22+
- 3306:3306
23+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
24+
continue-on-error: ${{ matrix.can_fail }}
25+
26+
name: WordPress ${{ matrix.wp_version }} @ PHP ${{ matrix.php }} (WP_MULTISITE=${{ matrix.multisite }})
27+
env:
28+
CACHEDIR: /tmp
29+
WP_CORE_DIR: /tmp/wordpress
30+
WP_VERSION: ${{ matrix.wp_version }}
31+
WP_MULTISITE: ${{ matrix.multisite }}
32+
WP_DB_HOST: 127.0.0.1
33+
WP_DB_USER: root
34+
WP_DB_PASSWORD: '""'
35+
36+
steps:
37+
- name: Check out code
38+
uses: actions/checkout@v3
39+
40+
- name: Set up PHP
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: ${{ matrix.php }}
44+
extensions: json, mysqli, curl, dom, exif, fileinfo, hash, imagick, mbstring, openssl, pcre, xml, zip
45+
46+
- name: Install composer dependencies
47+
uses: ramsey/composer-install@v2
48+
49+
- name: Run PHPUnit
50+
run: composer run-script phpunit

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
vendor
2+
composer.lock
3+
.php_cs.cache
4+
.phpunit.result.cache
5+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* PHP-CS-Fixer configuration
4+
*
5+
* (c) Alley <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*
10+
* @package wp-match-blocks
11+
*/
12+
13+
$finder = PhpCsFixer\Finder::create()->in(
14+
[
15+
__DIR__ . '/src/',
16+
__DIR__ . '/tests/',
17+
]
18+
);
19+
20+
$config = new PhpCsFixer\Config();
21+
$config->setRules(
22+
[
23+
'@PHP81Migration' => true,
24+
'method_argument_space' => false, // Enabled by '@PHP81Migration' but generates invalid spacing for WordPress.
25+
'heredoc_indentation' => false, // Enabled by '@PHP81Migration' but generates heredoc with syntax errors.
26+
27+
'final_class' => true,
28+
'native_constant_invocation' => true,
29+
'native_function_casing' => true,
30+
'native_function_invocation' => true,
31+
'native_function_type_declaration_casing' => true,
32+
]
33+
);
34+
$config->setFinder( $finder );
35+
36+
return $config;

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/).
4+
5+
## 1.0.0
6+
7+
Initial release.

0 commit comments

Comments
 (0)