Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
* development: (34 commits)
  Update wpdtrt-plugin-boilerplate, from 1.6.14 to 1.6.17
  Add cypress-plugin-retries (workaround for #80), add execa
  Add missing Cypress dependency libgconf-2.so.4 (fixes #74)
  Update wpdtrt-plugin-boilerplate, from 1.6.12 to 1.6.14
  Update dependencies
  Update wpdtrt-plugin-boilerplate, from 1.6.12 to 1.6.14
  Fix Bash conditionals
  Don't install Mono on CI on dev branch (dotherightthing/wpdtrt-plugin-boilerplate#173)
  Lint fixes
  Exclude PHPDoc sniffs
  TODO
  Ignore backup files
  Reinstate live website URL for Cypress tests
  Reinstate failing test (see #67)
  Fix variable name
  Ignore VS Code plugin configuration files (e.g. for XDebug launch)
  Use correct variable types (fixes #77)
  Revert to original filename for PHPUnit XML config file
  Ignore test images
  Use existing syntax to disable admin test
  ...
  • Loading branch information
dotherightthing committed Oct 11, 2019
2 parents 74dbd59 + 3e83bde commit 30a4797
Show file tree
Hide file tree
Showing 24 changed files with 284 additions and 100 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ vendor
wp-content
cypress/screenshots
cypress/videos
images/test1-*.jpg
.vscode
*.bak
18 changes: 13 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ language: php
php:
- 7.2.20 # MAMP

addons:
apt:
packages:
# Fix /home/travis/.cache/Cypress/3.4.1/Cypress/Cypress: error while loading shared libraries:
# libgconf-2.so.4: cannot open shared object file: No such file or directory
# see https://docs.cypress.io/guides/guides/continuous-integration.html#Travis
- libgconf-2-4

# Public Environment Variables
# https://docs.travis-ci.com/user/environment-variables
# https://github.com/meitar/wordpress-plugin-skeleton/blob/master/.travis.yml
Expand Down Expand Up @@ -65,11 +73,11 @@ before_install:
- phpenv config-rm xdebug.ini
# Install Mono (Natural Docs dependency)
# https://www.mono-project.com/download/stable/#download-lin-ubuntu
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
- sudo apt install apt-transport-https ca-certificates
- echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
- sudo apt update
- sudo apt install mono-complete
- if [ $TRAVIS_TAG ]; then sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF; fi
- if [ $TRAVIS_TAG ]; then sudo apt install apt-transport-https ca-certificates; fi
- if [ $TRAVIS_TAG ]; then echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list; fi
- if [ $TRAVIS_TAG ]; then sudo apt update; fi
- if [ $TRAVIS_TAG ]; then sudo apt install mono-complete; fi
# Unsure if this is required here, it is needed by generated plugins.
# See dotherightthing/generator-wpdtrt-plugin-boilerplate#88
- composer config -g github-oauth.github.com $GH_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"wiki": "https://github.com/dotherightthing/wpdtrt-gallery/wiki"
},
"require": {
"dotherightthing/wpdtrt-plugin-boilerplate": "^1.6.12"
"dotherightthing/wpdtrt-plugin-boilerplate": "^1.6.17"
},
"require-dev": {
"phpunit/phpunit": "^7.5.14",
Expand Down
18 changes: 9 additions & 9 deletions composer.lock

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

5 changes: 4 additions & 1 deletion cypress/integration/flows/wpdtrt-gallery--panorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
const componentClass = 'wpdtrt-gallery-viewer';
const sectionId = 'itchy-feet';

// https://github.com/Bkucera/cypress-plugin-retries
Cypress.env( 'RETRIES', 2 );

describe( 'DTRT Gallery - Image Gallery Item', function () {
before( function () {
// load local tour diary page
Expand Down Expand Up @@ -93,7 +96,7 @@ describe( 'DTRT Gallery - Image Gallery Item', function () {
.should( 'match', /wpsize=wpdtrt-gallery-panorama/ );
} );

it.skip( '2. Does contain a square thumbnail, described accessibly (Issue #67)', function () {
it( '2. Does contain a square thumbnail, described accessibly (Issue #67)', function () {
cy.get( '@wpdtrtGalleryFirstItem' ).find( 'img' ).as( 'wpdtrtGalleryFirstImage' );

cy.get( '@wpdtrtGalleryFirstImage' )
Expand Down
3 changes: 3 additions & 0 deletions cypress/integration/flows/wpdtrt-gallery-viewer--image.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
const componentClass = 'wpdtrt-gallery-viewer';
const sectionId = 'a-new-bike';

// https://github.com/Bkucera/cypress-plugin-retries
Cypress.env( 'RETRIES', 2 );

describe( 'DTRT Gallery - Image Viewer', function () {
before( function () {
// load local tour diary page
Expand Down
3 changes: 3 additions & 0 deletions cypress/integration/flows/wpdtrt-gallery-viewer--panorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
const componentClass = 'wpdtrt-gallery-viewer';
const sectionId = 'itchy-feet';

// https://github.com/Bkucera/cypress-plugin-retries
Cypress.env( 'RETRIES', 2 );

describe( 'DTRT Gallery - Panorama Viewer', function () {
before( function () {
// load local tour diary page
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
import './commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')
require( 'cypress-plugin-retries' );
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@
],
"license": "ISC",
"homepage": "https://github.com/dotherightthing/wpdtrt-gallery",
"srcDir": "/Volumes/DanBackup/Websites/wpdtrt-gallery"
"srcDir": "/Volumes/DanBackup/Websites/wpdtrt-gallery",
"devDependencies": {
"cypress-plugin-retries": "^1.3.0"
}
}
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
<exclude name="Squiz.Commenting.VariableComment.MissingVar"/>
<exclude name="Squiz.PHP.CommentedOutCode.Found"/>
<exclude name="WordPress.CSRF.NonceVerification"/>
<exclude name="WordPress.Files.FileName"/>
Expand Down
21 changes: 21 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stderr="true"
>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="plugin">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
4 changes: 2 additions & 2 deletions src/class-wpdtrt-gallery-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Since:
* 0.8.13 - DTRT WordPress Plugin Boilerplate Generator
*/
class WPDTRT_Gallery_Plugin extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_12\Plugin {
class WPDTRT_Gallery_Plugin extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_14\Plugin {

/**
* Constructor: __construct
Expand Down Expand Up @@ -366,7 +366,7 @@ public function filter_thumbnail_queryparams( string $html, int $id, string $siz
* See:
* - <https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_attributes/>
*/
public function filter_thumbnail_attributes( array $atts, object $attachment ) : array {
public function filter_thumbnail_attributes( array $atts, WP_Post $attachment ) : array {

$id = $attachment->ID;

Expand Down
2 changes: 1 addition & 1 deletion src/class-wpdtrt-gallery-rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* Extends the base class to inherit boilerplate functionality, adds application-specific methods.
*/
class WPDTRT_Gallery_Rewrite extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_12\Rewrite {
class WPDTRT_Gallery_Rewrite extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_14\Rewrite {

/**
* Function: __construct
Expand Down
2 changes: 1 addition & 1 deletion src/class-wpdtrt-gallery-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Since:
* 0.8.13 - DTRT WordPress Plugin Boilerplate Generator
*/
class WPDTRT_Gallery_Shortcode extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_12\Shortcode {
class WPDTRT_Gallery_Shortcode extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_14\Shortcode {

/**
* Constructor: __construct
Expand Down
2 changes: 1 addition & 1 deletion src/class-wpdtrt-gallery-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Since:
* 0.8.13 - DTRT WordPress Plugin Boilerplate Generator
*/
class WPDTRT_Gallery_Taxonomy extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_12\Taxonomy {
class WPDTRT_Gallery_Taxonomy extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_14\Taxonomy {

/**
* Function: __construct
Expand Down
2 changes: 1 addition & 1 deletion src/class-wpdtrt-gallery-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Since:
* 0.8.13 - DTRT WordPress Plugin Boilerplate Generator
*/
class WPDTRT_Gallery_Widget extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_12\Widget {
class WPDTRT_Gallery_Widget extends DoTheRightThing\WPDTRT_Plugin_Boilerplate\r_1_6_14\Widget {

/**
* Constructor: __construct
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/attachment-field-default.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function wpdtrt_gallery_attachment_field_default( array $form_fields, object $po
* See:
* - <https://stackoverflow.com/questions/4554758/how-to-read-if-a-checkbox-is-checked-in-php>
*/
function wpdtrt_gallery_attachment_field_default_save( object $post, array $attachment ) : object {
function wpdtrt_gallery_attachment_field_default_save( array $post, array $attachment ) : array {

// if checked.
if ( isset( $attachment['wpdtrt-gallery-default'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/attachment-field-location.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function wpdtrt_gallery_attachment_field_location( array $form_fields, object $p
* See:
* - <https://stackoverflow.com/questions/4554758/how-to-read-if-a-checkbox-is-checked-in-php>
*/
function wpdtrt_gallery_attachment_field_location_save( object $post, array $attachment ) : object {
function wpdtrt_gallery_attachment_field_location_save( array $post, array $attachment ) : array {
if ( isset( $attachment['wpdtrt-gallery-location'] ) ) {
update_post_meta( $post['ID'], 'wpdtrt_gallery_attachment_location', $attachment['wpdtrt-gallery-location'] );
}
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/attachment-field-panorama.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* See:
* - <https://code.tutsplus.com/articles/creating-custom-fields-for-attachments-in-wordpress--net-13076>
*/
function wpdtrt_gallery_attachment_field_panorama( array $form_fields, object $post ) : array {
function wpdtrt_gallery_attachment_field_panorama( array $form_fields, object $post ) {

// Get currently select value.
$selection = get_post_meta( $post->ID, 'wpdtrt_gallery_attachment_panorama', true );
Expand Down Expand Up @@ -77,7 +77,7 @@ function wpdtrt_gallery_attachment_field_panorama( array $form_fields, object $p
* TODO:
* - Calculate this automatically, or make it a theme option to do so
*/
function wpdtrt_gallery_attachment_field_panorama_save( object $post, array $attachment ) : object {
function wpdtrt_gallery_attachment_field_panorama_save( array $post, array $attachment ) : array {

if ( isset( $attachment['wpdtrt-gallery-panorama'] ) ) {
// if checked.
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/attachment-field-ridewithgps.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function wpdtrt_gallery_attachment_field_rwgps_pageid( array $form_fields, objec
* Returns:
* $post - Modified post data
*/
function wpdtrt_gallery_attachment_field_rwgps_pageid_save( object $post, array $attachment ) : object {
function wpdtrt_gallery_attachment_field_rwgps_pageid_save( array $post, array $attachment ) : array {

if ( isset( $attachment['wpdtrt-gallery-rwgps-pageid'] ) ) {
update_post_meta( $post['ID'], 'wpdtrt_gallery_attachment_rwgps_pageid', $attachment['wpdtrt-gallery-rwgps-pageid'] );
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/attachment-field-soundcloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function wpdtrt_gallery_attachment_field_soundcloud_pageid( array $form_fields,
* Returns:
* $post - Modified post data
*/
function wpdtrt_gallery_attachment_field_soundcloud_pageid_save( object $post, array $attachment ) : object {
function wpdtrt_gallery_attachment_field_soundcloud_pageid_save( array $post, array $attachment ) : array {

if ( isset( $attachment['wpdtrt-gallery-soundcloud-pageid'] ) ) {
update_post_meta( $post['ID'], 'wpdtrt_gallery_attachment_soundcloud_pageid', $attachment['wpdtrt-gallery-soundcloud-pageid'] );
Expand Down Expand Up @@ -89,7 +89,7 @@ function wpdtrt_gallery_attachment_field_soundcloud_trackid( array $form_fields,
* Returns:
* $post - Modified post data
*/
function wpdtrt_gallery_attachment_field_soundcloud_trackid_save( object $post, array $attachment ) : object {
function wpdtrt_gallery_attachment_field_soundcloud_trackid_save( array $post, array $attachment ) : array {

if ( isset( $attachment['wpdtrt-gallery-soundcloud-trackid'] ) ) {
update_post_meta( $post['ID'], 'wpdtrt_gallery_attachment_soundcloud_trackid', $attachment['wpdtrt-gallery-soundcloud-trackid'] );
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/attachment-field-vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function wpdtrt_gallery_attachment_field_vimeo_pageid( array $form_fields, objec
* Returns:
* $post - Modified post data
*/
function wpdtrt_gallery_attachment_field_vimeo_pageid_save( object $post, array $attachment ) : object {
function wpdtrt_gallery_attachment_field_vimeo_pageid_save( array $post, array $attachment ) : array {

if ( isset( $attachment['wpdtrt-gallery-vimeo-pageid'] ) ) {
update_post_meta( $post['ID'], 'wpdtrt_gallery_attachment_vimeo_pageid', $attachment['wpdtrt-gallery-vimeo-pageid'] );
Expand Down
Loading

0 comments on commit 30a4797

Please sign in to comment.