Skip to content

Commit 79aff0d

Browse files
authored
Merge pull request #211 from WordPoints/develop
2.6.0
2 parents f1c698b + ee246c4 commit 79aff0d

File tree

126 files changed

+10167
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+10167
-228
lines changed

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ language: php
55
php:
66
- 7.1
77

8-
# Use the new infrustructure.
8+
# Use the new infrastructure.
99
sudo: false
1010

1111
before_script:
@@ -14,13 +14,18 @@ before_script:
1414
- export DEV_LIB_PATH=none
1515
- source bin/env.sh
1616
- source bin/functions.sh
17+
- source travis/commands.sh
18+
- install-from-github WPCS
19+
- mkdir -p $PHPCS_DIR && git clone --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git -b master $PHPCS_DIR
20+
- $PHPCS_DIR/scripts/phpcs --config-set installed_paths "$WPCS_DIR",phpcs
1721

1822
script:
1923
- wpdl-codesniff-xmllint
2024
- wpdl-codesniff-bash
2125
- wpdl-codesniff-jshint
2226
- wpdl-codesniff-strings
23-
- find ./travis -name '*.yml' ! -name '.coveralls.yml' -exec travis-lint {} \;
27+
- wpdl-codesniff-phpcs
28+
- find ./travis -name '*.yml' -exec travis-lint {} \;
2429
- CODESNIFF_PATH_PHP_SYNTAX=("${CODESNIFF_PATH_PHP[@]}" '!' -path './wpcept/*' '!' -path './phpcs/*' '!' -path './l10n-validator/*'); phpenv global 5.2 && wpdl-codesniff-php-syntax
2530
- CODESNIFF_PATH_PHP_SYNTAX=("${CODESNIFF_PATH_PHP[@]}" '!' -path './wpcept/*'); phpenv global 5.3 && wpdl-codesniff-php-syntax; CODESNIFF_PATH_PHP_SYNTAX= A=$?; [[ $A == 0 ]]
2631
- phpenv global 5.4 && wpdl-codesniff-php-syntax
@@ -29,5 +34,6 @@ script:
2934
#- phpenv global 7.0 && wpdl-codesniff-php-syntax
3035
- phpenv global 7.1 && wpdl-codesniff-php-syntax
3136
- phpenv global hhvm && wpdl-codesniff-php-syntax
37+
- phpunit --filter WordPoints /tmp/phpcs/tests/AllTests.php
3238

3339
# EOF

.wordpoints-dev-lib-config.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
export DEV_LIB_PATH=.
4+
export CODESNIFF_PATH=(. '!' -path "./.idea/*" '!' -path "*/.git/*")
5+
6+
wordpoints-dev-lib-config() {
7+
8+
export CODESNIFF_PATH_PHP_AUTOLOADERS=(bin)
9+
}
10+
11+
# EOF

CHANGELOG.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,77 @@ All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55
And as you can see, we [keep a CHANGELOG](http://keepachangelog.com/).
66

7+
## [2.6.0] - 2017-04-19
8+
### Added
9+
- WordPress 4.7 to build matrix. #198
10+
- PHPUnit test suite bootstrap from WordPoints. #193
11+
- Points type factory for use in the PHPUnit tests. #200
12+
- Git `pre-commit` hook which automatically checks all staged files for codesniff issues. #20
13+
- Support for the `@requires WordPoints version` and `@WordPoints-version <version>` annotations for the PHPUnit tests, to require a particular WordPoints version for a test.
14+
- Support for the `@WordPoints-requires <callback>` annotation for the PHPUnit tests, to specify a boolean callback that must return a true result for the test to run.
15+
- Minification of CSS, JS, and images to the default Grunt config. #208
16+
- `Generic.Files.OneClassPerFile` and `Generic.Files.OneInterfacePerFile` to PHPCS ruleset.
17+
- Restricted PHPUnit assertions PHPCS sniff, which flags the use of non-strict assertions.
18+
- PHPCS ruleset for the dev-lib itself, which is also now checked via our Travis build.
19+
- Support for running the uninstall tests for a module to only uninstall the module, but not WordPoints, by setting `WORDPOINTS_ONLY_UNINSTALL_MODULE=1`. #192
20+
- Add these tests to the default Travis build.
21+
- `set-up` command to install dependencies and hook up the pre-commit hook when a user checks out a project using the dev-lib.
22+
- Also hooks up the pre-commit hook for the dev-lib as well.
23+
24+
### Changed
25+
- String sniffer to ignore all `.lock` files. #199
26+
- XMLLint check to only run if any `.xml` files exist. #201
27+
- The autoloader checker to automatically detect dependencies of an autoloader.
28+
- If for a module, the classes may be dependent on WordPoints core's main autoloader. #207
29+
- This in turn means that for modules we can no longer run the check on the codesniff pass on Travis CI, because WordPoints is not installed yet at that point.
30+
- The `CODESNIFF_PHP_AUTOLOADER_DEPENDENCIES` can be used to specify the default dependencies for a project.
31+
- WordPoints core's points component's classmaps are automatically assigned as dependencies for module classmaps within a `/points/` directory.
32+
- PHPCS ruleset to exclude the PHP syntax sniff. This is unnecessary since we already do syntax checks.
33+
- PHPCS ruleset to not run the i18n sniff on the tests.
34+
- Code coverage results to be submitted to codecov.io instead of Coveralls. #109
35+
- Env bootstrap to allow `$WP_DEVELOP_DIR` to be preset.
36+
- Env bootstrap to automatically set the WordPoints tests directory based on the develop directory.
37+
- Autoloader validator to automatically load the `WP_Widget` class in case any classes extend it.
38+
- Grunt config to automatically detect the module namespace as the prefix for the classes in the autoloader classmaps.
39+
- Updated default browserify version to 5.0.0.
40+
- Grunt to detect the first open port for livereload when running watch.
41+
- Travis bootstrap to update composer when running on PHP 5.2.
42+
- `makepot` command to automatically create the `languages` directory if needed.
43+
- PHPCS ruleset to disable class filename checks via `WordPress.Files.FileName`.
44+
- PHPCS ruleset to disable errors about associative arrays not being multiline from `WordPress.Arrays.ArrayDeclarationSpacing.AssociativeKeyFound`.
45+
- PHPCS ruleset to use the new method of restricting functions and variables.
46+
- PHPCS ruleset to use the new WordPress filename sniff instead of the Generic one.
47+
- `codesniff-phpcs` command to stop silencing warnings from PHPCS, so that they are shown in addition to errors.
48+
- Travis build to test our PHPCS sniffs.
49+
- Missing Echo PHPCS sniff, adding `$this->single_row_columns()` to the ignored list.
50+
- L10n validator config, adding ignore rules for the points logs widget.
51+
- PHPCS version used, updating it to 2.8.1
52+
- Module tests scaffold to replace the example with the module namespace.
53+
- Travis bootstrap to automatically use PHPUnit 5.7 when running on PHP 7 and PHP nightly.
54+
- PHPCS ruleset to allow `system()` calls in tests.
55+
- WPCS version to 607db751e90e6d32f96fcb15c4aec8609d059d57.
56+
- Travis bootstrap to not run against WordPoints stable and WordPress 4.6 on PHP 7.1.
57+
- Travis bootstrap to recognize that `master` is now the stable WordPoints branch, and `develop` is the development branch.
58+
- Travis bootstrap to use `develop` to denote WordPress trunk, for consistency.
59+
- PHPUnit bootstrap to automatically set up autoloading for a module's PHPUnit helper classes.
60+
- PHPCS Missing Echo sniff to ignore functions with names containing `display`.
61+
- L10n validator config to add `WordPoints_Modules::get_data()` to the ignores.
62+
- L10n validator confit to add `'.min'` to the default ignored strings.
63+
- `init` command to automatically detect the module namespace and set it as the class prefix for the autoloader generator, instead of just basing this of the directory name of the module.
64+
65+
### Deprecated
66+
- `WordPoints_Dev_Lib_PHPUnit_Class_Autoloader` in favor of `WordPoints_PHPUnit_Class_Autoloader`. #193
67+
- `WordPoints_Dev_Lib_PHPUnit_TestCase_Module_Uninstall` in favor of `WordPoints_PHPUnit_TestCase_Module_Uninstall`. #193
68+
69+
### Removed
70+
- Support for specifying autoloader dependencies in the Grunt config file. #207
71+
72+
### Fixed
73+
- The autoloader checker not checking a classmap file in the `src/classes` directory. #206
74+
- Grunt not detecting autoloader errors if they were written to `stdout` instead of `stderr`.
75+
- Fatal error from the makepot class due to the `$max_header_lines` property being private in the parent class.
76+
- PHPCS sniff not correctly flagging `wp_remote_*()` functions and recommending `wp_safe_remote_*()` instead.
77+
778
## [2.5.0] - 2016-12-09
879
### Added
980
- Default config file for Grunt, with a watch task to build the autoload classmaps. (#162)
@@ -257,6 +328,7 @@ automatically installed if there is a config file for it. #23
257328
- Initial code.
258329

259330
[Unreleased]: https://github.com/WordPoints/dev-lib/compare/master...develop
331+
[2.6.0]: https://github.com/WordPoints/dev-lib/compare/2.5.0...2.6.0
260332
[2.5.0]: https://github.com/WordPoints/dev-lib/compare/2.4.0...2.5.0
261333
[2.4.0]: https://github.com/WordPoints/dev-lib/compare/2.3.1...2.4.0
262334
[2.3.1]: https://github.com/WordPoints/dev-lib/compare/2.3.0...2.3.1

bin/env.sh

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,71 @@
11
#!/usr/bin/env bash
22

33
# Paths
4-
export WP_DEVELOP_DIR=/tmp/wordpress
4+
if [[ -z $WP_DEVELOP_DIR ]]; then
5+
export WP_DEVELOP_DIR=/tmp/wordpress
6+
fi
7+
58
if [[ -z $WP_TESTS_DIR ]]; then
6-
export WP_TESTS_DIR=/tmp/wordpress/tests/phpunit
9+
export WP_TESTS_DIR="$WP_DEVELOP_DIR/tests/phpunit"
710
fi
8-
export WP_CORE_DIR=/tmp/wordpress/src
11+
12+
if [[ -z $WP_CORE_DIR ]]; then
13+
export WP_CORE_DIR="$WP_DEVELOP_DIR/src"
14+
fi
15+
916
export PROJECT_DIR=$(pwd)/src
1017
export PROJECT_SLUG=$(basename "$(pwd)" | sed 's/^wp-//')
1118

1219
# Codesniff path
13-
CODESNIFF_PATH=(. '!' -path "./$DEV_LIB_PATH/*" '!' -path "./vendor/*" '!' -path "./.idea/*" '!' -path "./node_modules/*")
20+
if [[ -z $CODESNIFF_PATH ]]; then
21+
CODESNIFF_PATH=(. '!' -path "./$DEV_LIB_PATH/*" '!' -path "./vendor/*" '!' -path "./.idea/*" '!' -path "./node_modules/*" '!' -path "*/.git/*")
22+
fi
23+
1424
CODESNIFF_PATH_PHP=("${CODESNIFF_PATH[@]}" '(' -name '*.php' -o -name '*.inc' ')')
15-
CODESNIFF_PATH_PHP_AUTOLOADERS=("${CODESNIFF_PATH_PHP[@]}" -path './src/*/classes')
25+
CODESNIFF_PATH_PHP_AUTOLOADERS=(src -path '*/classes')
26+
CODESNIFF_PATH_PHP_L10N_VALIDATOR=(. -path "./src/*" '(' -name '*.php' -o -name '*.inc' ')')
1627

1728
# Codeception requires PHP 5.4+.
1829
if [[ $TRAVIS_PHP_VERSION == '5.2' || $TRAVIS_PHP_VERSION == '5.3' ]]; then
1930
CODESNIFF_PATH_PHP_SYNTAX=("${CODESNIFF_PATH_PHP[@]}" '!' -path "./tests/codeception/*")
2031
fi
2132

33+
CODESNIFF_PATH_JS=("${CODESNIFF_PATH[@]}" -name '*.js')
2234
CODESNIFF_PATH_XML=("${CODESNIFF_PATH[@]}" '(' -name '*.xml' -o -name '*.xml.dist' ')')
2335
CODESNIFF_PATH_BASH=("${CODESNIFF_PATH[@]}" -name '*.sh')
24-
CODESNIFF_PATH_STRINGS=("${CODESNIFF_PATH[@]}" -type f '!' -name composer.lock '!' -path "*/_generated/*" '!' -path "*/_output/*" '!' -path "*/.git/*")
36+
CODESNIFF_PATH_STRINGS=("${CODESNIFF_PATH[@]}" '!' -name "*.lock" '!' -path "*/_generated/*" '!' -path "*/_output/*")
2537
CODESNIFF_IGNORED_STRINGS=(-e http://semver.org/ -e http://keepachangelog.com/ -e http://www.php-fig.org/ -e http://127.0.0.1:8080 -e CODESNIFF_IGNORED_STRINGS -e 'grep -e')
2638

2739
export CODESNIFF_PATH
40+
export CODESNIFF_PATH_JS
2841
export CODESNIFF_PATH_PHP
2942
export CODESNIFF_PATH_PHP_AUTOLOADERS
43+
export CODESNIFF_PATH_PHP_L10N_VALIDATOR
3044
export CODESNIFF_PATH_PHP_SYNTAX
3145
export CODESNIFF_PATH_XML
3246
export CODESNIFF_PATH_BASH
3347
export CODESNIFF_PATH_STRINGS
3448
export CODESNIFF_IGNORED_STRINGS
3549

50+
# Autoloaders
51+
CODESNIFF_PHP_AUTOLOADER_DEPENDENCIES=()
52+
53+
if [[ $WORDPOINTS_PROJECT_TYPE == module ]]; then
54+
CODESNIFF_PHP_AUTOLOADER_DEPENDENCIES+=("${WORDPOINTS_DEVELOP_DIR}/src/classes/")
55+
fi
56+
57+
export CODESNIFF_PHP_AUTOLOADER_DEPENDENCIES
58+
3659
# PHPCS
3760
export DO_PHPCS=$(if [ -e phpcs.ruleset.xml ]; then echo 1; else echo 0; fi)
3861
export PHPCS_DIR=/tmp/phpcs
3962
export PHPCS_GITHUB_SRC=squizlabs/PHP_CodeSniffer
40-
export PHPCS_GIT_TREE=4122da6604e2967c257d6c81151122d08cae60cf
63+
export PHPCS_GIT_TREE=2.8.1
4164

4265
# WPCS
4366
export WPCS_DIR=/tmp/wpcs
4467
export WPCS_GITHUB_SRC=WordPress-Coding-Standards/WordPress-Coding-Standards
45-
export WPCS_GIT_TREE=b39490465f6fd7375743a395019cd597e12119c9
68+
export WPCS_GIT_TREE=607db751e90e6d32f96fcb15c4aec8609d059d57
4669
export WPCS_STANDARD=$(if [ -e phpcs.ruleset.xml ]; then echo phpcs.ruleset.xml; else echo WordPress; fi)
4770

4871
# WP L10n Validator
@@ -55,22 +78,35 @@ export WPL10NV_GIT_TREE=develop
5578
export DO_PHPUNIT=$(if [ -e phpunit.xml.dist ]; then echo 1; else echo 0; fi)
5679
export RUN_UNINSTALL_TESTS=$(if [[ $DO_PHPUNIT == 1 ]] && ([[ -e phpunit.uninstall.xml.dist ]] || grep -q '<group>ajax</group>' phpunit.xml.dist); then echo 1; else echo 0; fi)
5780
export RUN_AJAX_TESTS=$(if [[ $DO_PHPUNIT == 1 ]] && grep -q '<group>ajax</group>' phpunit.xml.dist; then echo 1; else echo 0; fi)
58-
export DO_CODE_COVERAGE=$(if [[ $TRAVIS_PHP_VERSION == hhvm ]] && [ -e .coveralls.yml ]; then echo 1; else echo 0; fi)
81+
export DO_CODE_COVERAGE=$(if [[ $TRAVIS_PHP_VERSION == hhvm ]] && grep -q codecov README.md; then echo 1; else echo 0; fi)
5982

6083
# WP Browser (Codeception)
6184
export DO_WP_CEPT=$(if [[ $TRAVIS_PHP_VERSION == '5.6' ]] && (shopt -s nullglob; f=(tests/codeception/acceptance/*.cept.php); ((${#f[@]}))); then echo 1; else echo 0; fi)
6285
export WP_CEPT_SERVER='127.0.0.1:8080'
6386

6487
# WordPoints
65-
export WORDPOINTS_DEVELOP_DIR=/tmp/wordpoints
66-
export WORDPOINTS_TESTS_DIR=/tmp/wordpoints/tests/phpunit/
88+
if [[ -z $WORDPOINTS_DEVELOP_DIR ]]; then
89+
export WORDPOINTS_DEVELOP_DIR=/tmp/wordpoints
90+
fi
91+
92+
if [[ $WORDPOINTS_PROJECT_TYPE == wordpoints ]]; then
93+
export WORDPOINTS_TESTS_DIR=/home/travis/build/WordPoints/wordpoints/tests/phpunit/
94+
else
95+
export WORDPOINTS_TESTS_DIR="$WORDPOINTS_DEVELOP_DIR/tests/phpunit/"
96+
fi
97+
6798
if [[ -z $WORDPOINTS_VERSION ]]; then
68-
export WORDPOINTS_VERSION=master
99+
export WORDPOINTS_VERSION=develop
69100
fi
70101

71102
# WordPoints Module
72103
if [[ $WORDPOINTS_PROJECT_TYPE == module ]]; then
73104
export WORDPOINTS_MODULE="${PROJECT_SLUG}\\${PROJECT_SLUG}.php"
74105
fi
75106

107+
# Git Pre-commit Hook
108+
if [[ $DOING_GIT_PRE_COMMIT == 1 ]]; then
109+
STAGED_FILES=$(git diff --diff-filter=AM --staged --name-only | awk '$0="./"$0')
110+
fi
111+
76112
# EOF

0 commit comments

Comments
 (0)