Skip to content

Commit

Permalink
Merge pull request #483 from szepeviktor/fix/ci
Browse files Browse the repository at this point in the history
Fix include CI jobs
  • Loading branch information
pattonwebz committed Jul 21, 2020
2 parents 9b6cd7c + e6b4919 commit 56b9f81
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
13 changes: 8 additions & 5 deletions .travis.yml
Expand Up @@ -25,16 +25,24 @@ jobs:
dist: xenial
env:
- WP_VERSION=latest WP_MULTISITE=0 PHPUNIT_VERSION="^5.6"
- php: 7.0
dist: xenial
env:
- WP_VERSION=latest WP_MULTISITE=1 PHPUNIT_VERSION="^5.6"
- php: 5.6
dist: xenial
env:
- WP_VERSION=latest WP_MULTISITE=0 PHPUNIT_VERSION="4.8.*"
- php: 5.6
dist: xenial
env:
- WP_VERSION=latest WP_MULTISITE=1 PHPUNIT_VERSION="4.8.*"
- name: "Coding Standars"
php: 7.4
install:
- composer require --dev wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer
# Counter wp-enforcer
- rm -f ./phpcs.xml
script:
- vendor/bin/phpcs
- name: "Static Analysis"
Expand All @@ -54,11 +62,6 @@ cache:
directories:
- "${HOME}/.composer/cache"

before_install:
- composer remove --dev stevegrunwell/wp-enforcer
# Shim Composer's post-install-cmd script
- install -T /dev/null vendor/bin/wp-enforcer

install:
- bin/install-wp-tests.sh wordpress_test root "" localhost "${WP_VERSION}"
- composer global require --dev "phpunit/phpunit=${PHPUNIT_VERSION}"
Expand Down
3 changes: 2 additions & 1 deletion class-wp-bootstrap-navwalker.php
Expand Up @@ -376,7 +376,8 @@ public static function fallback( $args ) {

// if $args has 'echo' key and it's true echo, otherwise return.
if ( array_key_exists( 'echo', $args ) && $args['echo'] ) {
echo $fallback_output; // WPCS: XSS OK.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $fallback_output;
} else {
return $fallback_output;
}
Expand Down
6 changes: 5 additions & 1 deletion phpstan.neon.dist
Expand Up @@ -7,7 +7,7 @@ parameters:
checkMissingIterableValueType: false
paths:
- class-wp-bootstrap-navwalker.php
autoload_files:
scanFiles:
- tests/phpstan/class-wp-nav-menu-args.php
- tests/phpstan/class-wp-nav-menu-item.php
- class-wp-bootstrap-navwalker.php
Expand All @@ -22,3 +22,7 @@ parameters:
-
message: '#^Method WP_Bootstrap_Navwalker::(start_lvl|start_el)\(\) has no return typehint specified\.$#'
path: class-wp-bootstrap-navwalker.php
# Uncertain properties.
-
message: '#^Property WP_Nav_Menu_Args::\$\S+ \(string\) in isset\(\) is not nullable\.$#'
path: class-wp-bootstrap-navwalker.php
35 changes: 24 additions & 11 deletions tests/test-navwalker.php
Expand Up @@ -39,14 +39,17 @@ public function setUp() {
$this->valid_linkmod_typeflags = array(
'dropdown-header',
'dropdown-divider',
'dropdown-item-text'
'dropdown-item-text',
);

// array of all possible linkmods, including the valid typeflags.
$this->valid_linkmod_classes = array_merge( $this->valid_linkmod_typeflags, array(
'disabled',
'sr-only',
) );
$this->valid_linkmod_classes = array_merge(
$this->valid_linkmod_typeflags,
array(
'disabled',
'sr-only',
)
);

// array of valid font-awesome icon class starters plus some randomly
// chosen icon classes and some variations of upper/lower case letters.
Expand Down Expand Up @@ -186,9 +189,14 @@ public function test_fallback_function_output_loggedout() {
);

// set 'echo' to false and request the markup returned.
$fallback_output_return = WP_Bootstrap_Navwalker::fallback( array_merge( $this->valid_sample_fallback_args, array(
'echo' => false,
) ) );
$fallback_output_return = WP_Bootstrap_Navwalker::fallback(
array_merge(
$this->valid_sample_fallback_args,
array(
'echo' => false,
)
)
);

// return and echo should result in the same values (both empty).
$this->assertEquals(
Expand Down Expand Up @@ -227,9 +235,14 @@ public function test_fallback_function_output_loggedin() {
);

// set 'echo' to false and request the markup returned.
$fallback_output_return = WP_Bootstrap_Navwalker::fallback( array_merge( $this->valid_sample_fallback_args, array(
'echo' => false,
) ) );
$fallback_output_return = WP_Bootstrap_Navwalker::fallback(
array_merge(
$this->valid_sample_fallback_args,
array(
'echo' => false,
)
)
);

// return and echo should both produce the same strings.
$this->assertEquals(
Expand Down

0 comments on commit 56b9f81

Please sign in to comment.