From 14330396b51db5fc3f17c7b6b29e93794208b460 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Tue, 5 Feb 2019 09:47:37 -0800
Subject: [PATCH] Add WP-CLI scaffold bits that are missing

---
 .distignore                        |  35 +++++++
 .editorconfig                      |  22 ++++
 .gitignore                         |   9 ++
 .gitlab-ci.yml                     |  65 ++++++++++++
 .phpcs.xml.dist                    |  49 +++++++++
 Gruntfile.js                       |  56 ++++++++++
 README.md                          | 132 ++++++++++++++++++++++++
 bin/install-wp-tests.sh            | 155 ++++++++++++++++++++++++++++
 languages/view-all-posts-pages.pot | 157 +++++++++++++++++++++++++++++
 package.json                       |  11 ++
 phpunit.xml.dist                   |  16 +++
 readme.txt                         |   2 +-
 tests/bootstrap.php                |  31 ++++++
 tests/test-sample.php              |  20 ++++
 view-all-posts-pages.php           |  49 ++++-----
 15 files changed, 785 insertions(+), 24 deletions(-)
 create mode 100755 .distignore
 create mode 100755 .editorconfig
 create mode 100755 .gitignore
 create mode 100755 .gitlab-ci.yml
 create mode 100644 .phpcs.xml.dist
 create mode 100755 Gruntfile.js
 create mode 100644 README.md
 create mode 100755 bin/install-wp-tests.sh
 create mode 100644 languages/view-all-posts-pages.pot
 create mode 100755 package.json
 create mode 100644 phpunit.xml.dist
 create mode 100755 tests/bootstrap.php
 create mode 100755 tests/test-sample.php

diff --git a/.distignore b/.distignore
new file mode 100755
index 0000000..de45f50
--- /dev/null
+++ b/.distignore
@@ -0,0 +1,35 @@
+# A set of files you probably don't want in your WordPress.org distribution
+.distignore
+.editorconfig
+.git
+.gitignore
+.gitlab-ci.yml
+.travis.yml
+.DS_Store
+Thumbs.db
+behat.yml
+bitbucket-pipelines.yml
+bin
+.circleci/config.yml
+composer.json
+composer.lock
+Gruntfile.js
+package.json
+package-lock.json
+phpunit.xml
+phpunit.xml.dist
+multisite.xml
+multisite.xml.dist
+.phpcs.xml
+phpcs.xml
+.phpcs.xml.dist
+phpcs.xml.dist
+README.md
+wp-cli.local.yml
+yarn.lock
+tests
+vendor
+node_modules
+*.sql
+*.tar.gz
+*.zip
diff --git a/.editorconfig b/.editorconfig
new file mode 100755
index 0000000..79207a4
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,22 @@
+# This file is for unifying the coding style for different editors and IDEs
+# editorconfig.org
+
+# WordPress Coding Standards
+# https://make.wordpress.org/core/handbook/coding-standards/
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+indent_style = tab
+indent_size = 4
+
+[{.jshintrc,*.json,*.yml}]
+indent_style = space
+indent_size = 2
+
+[{*.txt,wp-config-sample.php}]
+end_of_line = crlf
diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..6f68bc7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+.DS_Store
+phpcs.xml
+phpunit.xml
+Thumbs.db
+wp-cli.local.yml
+node_modules/
+*.sql
+*.tar.gz
+*.zip
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100755
index 0000000..78d1f13
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,65 @@
+variables:
+  # Configure mysql service (https://hub.docker.com/_/mysql/)
+  MYSQL_DATABASE: wordpress_tests
+  MYSQL_ROOT_PASSWORD: mysql
+
+before_script:
+  # Install dependencies
+  
+  # update the docker
+  - apt-get clean
+  - apt-get -yqq update
+
+  # instll the required packages for the running CI tests
+  - apt-get -yqqf install zip unzip subversion mysql-client libmysqlclient-dev --fix-missing
+
+  # PHP extensions
+  - docker-php-ext-enable mbstring mcrypt mysqli pdo_mysql intl gd zip bz2
+
+  # Set up WordPress tests
+  - bash bin/install-wp-tests.sh wordpress_tests root mysql mysql latest true
+
+  # Install PHPCS and WPCS
+  - composer global require "squizlabs/php_codesniffer=*"
+  - composer global require "wp-coding-standards/wpcs"
+  - phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
+
+PHPunit:PHP5.3:MySQL:
+  image: tetraweb/php:5.3
+  services:
+    - mysql:5.6
+  script:
+  - phpcs
+  - phpunit
+
+PHPunit:PHP5.6:MySQL:
+  image: tetraweb/php:5.6
+  services:
+    - mysql:5.6
+  script:
+  - phpcs
+  - phpunit
+  
+PHPunit:PHP7.0:MySQL:
+  image: tetraweb/php:7.0
+  services:
+    - mysql:5.6
+  script:
+  - phpcs
+  - phpunit
+
+PHPunit:PHP7.1:MySQL:
+  image: tetraweb/php:7.1
+  services:
+    - mysql:5.6
+  script:
+  - phpcs
+  - phpunit
+
+PHPunit:PHP7.2:MySQL:
+  image: tetraweb/php:7.2
+  services:
+    - mysql:5.6
+  script:
+  - phpcs
+  - phpunit
diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
new file mode 100644
index 0000000..067d574
--- /dev/null
+++ b/.phpcs.xml.dist
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
+	<description>Generally-applicable sniffs for WordPress plugins.</description>
+
+	<!-- What to scan -->
+	<file>.</file>
+	<exclude-pattern>/vendor/</exclude-pattern>
+	<exclude-pattern>/node_modules/</exclude-pattern>
+
+	<!-- How to scan -->
+	<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
+	<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
+	<arg value="sp"/> <!-- Show sniff and progress -->
+	<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
+	<arg name="colors"/>
+	<arg name="extensions" value="php"/>
+	<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
+
+	<!-- Rules: Check PHP version compatibility -->
+	<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
+	<config name="testVersion" value="5.3-"/>
+	<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
+	<rule ref="PHPCompatibilityWP"/>
+
+	<!-- Rules: WordPress Coding Standards -->
+	<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
+	<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
+	<config name="minimum_supported_wp_version" value="4.6"/>
+	<rule ref="WordPress">
+		<exclude name="WordPress.VIP"/>
+	</rule>
+	<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
+		<properties>
+			<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
+			<property name="prefixes" type="array" value="my-plugin"/>
+		</properties>
+	</rule>
+	<rule ref="WordPress.WP.I18n">
+		<properties>
+			<!-- Value: replace the text domain used. -->
+			<property name="text_domain" type="array" value="my-plugin"/>
+		</properties>
+	</rule>
+	<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
+		<properties>
+			<property name="blank_line_check" value="true"/>
+		</properties>
+	</rule>
+</ruleset>
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100755
index 0000000..c3f1118
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,56 @@
+module.exports = function( grunt ) {
+
+	'use strict';
+
+	// Project configuration
+	grunt.initConfig( {
+
+		pkg: grunt.file.readJSON( 'package.json' ),
+
+		addtextdomain: {
+			options: {
+				textdomain: 'view_all_posts_pages',
+			},
+			update_all_domains: {
+				options: {
+					updateDomains: true
+				},
+				src: [ '*.php', '**/*.php', '!\.git/**/*', '!bin/**/*', '!node_modules/**/*', '!tests/**/*' ]
+			}
+		},
+
+		wp_readme_to_markdown: {
+			your_target: {
+				files: {
+					'README.md': 'readme.txt'
+				}
+			},
+		},
+
+		makepot: {
+			target: {
+				options: {
+					domainPath: '/languages',
+					exclude: [ '\.git/*', 'bin/*', 'node_modules/*', 'tests/*' ],
+					mainFile: 'view-all-posts-pages.php',
+					potFilename: 'view-all-posts-pages.pot',
+					potHeaders: {
+						poedit: true,
+						'x-poedit-keywordslist': true
+					},
+					type: 'wp-plugin',
+					updateTimestamp: true
+				}
+			}
+		},
+	} );
+
+	grunt.loadNpmTasks( 'grunt-wp-i18n' );
+	grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' );
+	grunt.registerTask( 'default', [ 'i18n','readme' ] );
+	grunt.registerTask( 'i18n', ['addtextdomain', 'makepot'] );
+	grunt.registerTask( 'readme', ['wp_readme_to_markdown'] );
+
+	grunt.util.linefeed = '\n';
+
+};
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4a1e8c6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,132 @@
+# View All Post's Pages #
+**Contributors:** ethitter, thinkoomph  
+**Donate link:** http://www.thinkoomph.com/plugins-modules/view-all-posts-pages/  
+**Tags:** view all, pages, paged, paged post, multipage, single view, single page, wp_link_pages, nextpage, next page, quicktag  
+**Requires at least:** 3.2.1  
+**Tested up to:** 5.0  
+**Stable tag:** 0.9.1  
+**License:** GPLv2 or later  
+**License URI:** http://www.gnu.org/licenses/gpl-2.0.html  
+
+Provides a "view all" (single page) option for content paged using WordPress' &lt;!--nextpage--&gt; Quicktag (multipage posts).
+## Description ##
+
+Provides a "view all" (single page) option for posts, pages, and custom post types paged using WordPress' <a href="http://codex.wordpress.org/Write_Post_SubPanel#Quicktags" target="_blank"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> (multipage posts).
+
+Your theme must use `wp_link_pages()` to generate post page links, or you must use either the automatic or manual link capabilities provided in the plugin.
+
+**IMPORTANT**: There are certain plugins that may interfere with this plugin's functionality. See the **FAQ** for more information.
+
+## Installation ##
+
+1. Upload view-all-posts-pages.php to /wp-content/plugins/.
+2. Activate plugin through the WordPress Plugins menu.
+3. Navigate to Options > Permalinks and click *Save Changes* to update navigation.
+
+## Frequently Asked Questions ##
+
+### Links don't work ###
+First, navigate to Options > Permalinks in WP Admin, click *Save Changes*, and try again.
+
+If clicking on a link takes you back to the post or page where the link appeared, see the **Known Plugin Conflicts** item below.
+
+If, after reviewing the remaining FAQ, you are still experiencing problems, visit [http://www.thinkoomph.com/plugins-modules/view-all-posts-pages/](http://www.thinkoomph.com/plugins-modules/view-all-posts-pages/) and leave a comment detailing the problem.
+
+### How do I add a link to my template? ###
+The function `vapp_the_link` will add a link to the full-content version of whatever page it appears on. This function accepts the following arguments:
+
+* **$link_text**: Set to text that should appear for the link. Defaults to *View All*.
+* **$class**: Specifies the CSS class for the link. Defaults to *vapp*.
+
+### Known Plugin Conflicts ###
+This plugin is known to conflict with certain plugins, many pertaining to SEO and permalinks. Conflicting plugins include, but are not limited to, the following:
+
+* **WordPress SEO by Yoast:** This plugin's `Permalink` options, particularly *Redirect attachment URL's to parent post URL* and *Redirect ugly URL's to clean permalinks. (Not recommended in many cases!)*, interfere with View All Post's Pages' ability to display full content. Both must be disabled, and the site's rewrite rules regenerated (by visiting Options > Permalinks and clicking *Save Changes*), for View All Post's Pages to function.
+
+## Changelog ##
+
+### 0.9.1 ###
+* Security update: correct misuse of `add_query_arg()` as identified by Sucuri: https://blog.sucuri.net/2015/04/security-advisory-xss-vulnerability-affecting-multiple-wordpress-plugins.html.
+
+### 0.9 ###
+* Move conditional registration of some filters to `init`, both to ensure external code can interact with filters and to avoid PHP notices.
+
+### 0.8.1 ###
+* Correct translation implementation issue introduced in v0.8.
+
+### 0.8 ###
+* When WordPress determines a request is a 404, don't activate the plugin's functionality.
+* Convert the plugin to a singleton.
+* Audit entire plugin for translation readyness.
+* Correct phpdoc.
+
+### 0.7 ###
+* Further ensure that WordPress doesn't think a post is paged when viewing the full post content unpaged. Ensures that code checking the `$multipage` variable will function properly. Props @batmoo.
+
+### 0.6.1 ###
+* Revert change in is_view_all() method made in version 0.6 as it breaks the method, rendering the plugin inoperable.
+
+### 0.6 ###
+* Add additional rewrite rules for situations where verbose page rules are required.
+* Disable canonical redirect when print template is requested.
+* Update is_print() method to use WordPress API.
+* Correct translation string implementation.
+
+### 0.5 ###
+* Change how post content is modified for View All display. Rather than using the `the_content` filter, global variables are overridden in the `the_post` action. Ensures that infinite loops don't result from shortcode processing and other uses of the `the_content` filter. Props to the WordPress.com VIP Support team (batmoo) and stevenkword.
+* Introduces the `vapp_display_link` filter to allow plugins and themes to suppress the automatic View All link on specific posts. Return `false` to suppress the link. Filter also passes post ID, plugin options, and post object.
+
+### 0.4.1 ###
+* Eliminate use of plugins_loaded action since plugin has no dependencies on other plugins. All code previously located in the associated method has been moved to the class's constructor. Props danielbachhuber.
+
+### 0.4 ###
+* Add filter to disable rewrite rules notice.
+* Apply esc_html() to link text during output.
+* Update code to conform to WordPress Coding Standards.
+
+### 0.3 ###
+* Simplify rewrite rule creation, resolving 404 errors in most cases.
+
+### 0.2 ###
+* Change how wp_link_pages arguments are filtered to better support as-needed filtering.
+
+### 0.1 ###
+* Initial release
+
+## Upgrade Notice ##
+
+### 0.9.1 ###
+Security update: correct misuse of `add_query_arg()` as identified by Sucuri: https://blog.sucuri.net/2015/04/security-advisory-xss-vulnerability-affecting-multiple-wordpress-plugins.html.
+
+### 0.9 ###
+Recommended update for anyone hoping to use plugin's filters to modify its behaviour.
+
+### 0.8.1 ###
+Recommended upgrade for anyone translating plugin's interface.
+
+### 0.8 ###
+Plugin won't unnecessarily execute its functionality if no posts are available and is now more thoroughly translatable.
+
+### 0.7 ###
+Further ensures plugins and themes correctly see a "View All" page as full post content.
+
+### 0.6.1 ###
+Resolves a problem where requests for view-all templates redirect to the article.
+
+### 0.6 ###
+Adds better support for sites that use verbose page rules, resolving situations where requests for view-all template redirect to the post.
+
+### 0.5 ###
+Infinite loops may result from previous method used to display entire post's content for the View All display. This update eliminates that possibility by using the the_post action rather than the the_content filter. Props to the WordPress.com VIP Support team (batmoo) and stevenkword.
+
+### 0.4.1 ###
+Eliminates use of plugins_loaded action since plugin has no dependencies on other plugins. All code previously located in the associated method has been moved to the class's constructor. props danielbachhuber.
+
+### 0.4 ###
+Adds filter to disable rewrite rules notice. Also applies esc_html() to link text when output since HTML isn't permitted in the link text.
+
+### 0.3 ###
+Simplifies rewrite rules, resolving 404 errors in most cases.
+
+### 0.2 ###
+Introduces helper function for wp_link_pages arguments and split filtering from plugin options.
diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh
new file mode 100755
index 0000000..5ceac4b
--- /dev/null
+++ b/bin/install-wp-tests.sh
@@ -0,0 +1,155 @@
+#!/usr/bin/env bash
+
+if [ $# -lt 3 ]; then
+	echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
+	exit 1
+fi
+
+DB_NAME=$1
+DB_USER=$2
+DB_PASS=$3
+DB_HOST=${4-localhost}
+WP_VERSION=${5-latest}
+SKIP_DB_CREATE=${6-false}
+
+TMPDIR=${TMPDIR-/tmp}
+TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
+WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
+WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
+
+download() {
+    if [ `which curl` ]; then
+        curl -s "$1" > "$2";
+    elif [ `which wget` ]; then
+        wget -nv -O "$2" "$1"
+    fi
+}
+
+if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
+	WP_BRANCH=${WP_VERSION%\-*}
+	WP_TESTS_TAG="branches/$WP_BRANCH"
+
+elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
+	WP_TESTS_TAG="branches/$WP_VERSION"
+elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
+	if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
+		# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
+		WP_TESTS_TAG="tags/${WP_VERSION%??}"
+	else
+		WP_TESTS_TAG="tags/$WP_VERSION"
+	fi
+elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
+	WP_TESTS_TAG="trunk"
+else
+	# http serves a single offer, whereas https serves multiple. we only want one
+	download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
+	grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
+	LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
+	if [[ -z "$LATEST_VERSION" ]]; then
+		echo "Latest WordPress version could not be found"
+		exit 1
+	fi
+	WP_TESTS_TAG="tags/$LATEST_VERSION"
+fi
+set -ex
+
+install_wp() {
+
+	if [ -d $WP_CORE_DIR ]; then
+		return;
+	fi
+
+	mkdir -p $WP_CORE_DIR
+
+	if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
+		mkdir -p $TMPDIR/wordpress-nightly
+		download https://wordpress.org/nightly-builds/wordpress-latest.zip  $TMPDIR/wordpress-nightly/wordpress-nightly.zip
+		unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
+		mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
+	else
+		if [ $WP_VERSION == 'latest' ]; then
+			local ARCHIVE_NAME='latest'
+		elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
+			# https serves multiple offers, whereas http serves single.
+			download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json
+			if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
+				# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
+				LATEST_VERSION=${WP_VERSION%??}
+			else
+				# otherwise, scan the releases and get the most up to date minor version of the major release
+				local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
+				LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
+			fi
+			if [[ -z "$LATEST_VERSION" ]]; then
+				local ARCHIVE_NAME="wordpress-$WP_VERSION"
+			else
+				local ARCHIVE_NAME="wordpress-$LATEST_VERSION"
+			fi
+		else
+			local ARCHIVE_NAME="wordpress-$WP_VERSION"
+		fi
+		download https://wordpress.org/${ARCHIVE_NAME}.tar.gz  $TMPDIR/wordpress.tar.gz
+		tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
+	fi
+
+	download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
+}
+
+install_test_suite() {
+	# portable in-place argument for both GNU sed and Mac OSX sed
+	if [[ $(uname -s) == 'Darwin' ]]; then
+		local ioption='-i.bak'
+	else
+		local ioption='-i'
+	fi
+
+	# set up testing suite if it doesn't yet exist
+	if [ ! -d $WP_TESTS_DIR ]; then
+		# set up testing suite
+		mkdir -p $WP_TESTS_DIR
+		svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
+		svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
+	fi
+
+	if [ ! -f wp-tests-config.php ]; then
+		download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
+		# remove all forward slashes in the end
+		WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
+		sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
+		sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
+		sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
+		sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
+		sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
+	fi
+
+}
+
+install_db() {
+
+	if [ ${SKIP_DB_CREATE} = "true" ]; then
+		return 0
+	fi
+
+	# parse DB_HOST for port or socket references
+	local PARTS=(${DB_HOST//\:/ })
+	local DB_HOSTNAME=${PARTS[0]};
+	local DB_SOCK_OR_PORT=${PARTS[1]};
+	local EXTRA=""
+
+	if ! [ -z $DB_HOSTNAME ] ; then
+		if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
+			EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
+		elif ! [ -z $DB_SOCK_OR_PORT ] ; then
+			EXTRA=" --socket=$DB_SOCK_OR_PORT"
+		elif ! [ -z $DB_HOSTNAME ] ; then
+			EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
+		fi
+	fi
+
+	# create database
+	mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
+}
+
+install_wp
+install_test_suite
+install_db
diff --git a/languages/view-all-posts-pages.pot b/languages/view-all-posts-pages.pot
new file mode 100644
index 0000000..6b515e1
--- /dev/null
+++ b/languages/view-all-posts-pages.pot
@@ -0,0 +1,157 @@
+# Copyright (C) 2019 Erick Hitter & Oomph, Inc.
+# This file is distributed under the same license as the View All Posts Pages package.
+msgid ""
+msgstr ""
+"Project-Id-Version: View All Posts Pages 0.9.1\n"
+"Report-Msgid-Bugs-To: "
+"https://wordpress.org/support/plugin/view-all-posts-pages\n"
+"POT-Creation-Date: 2019-02-05 17:47:01+00:00\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"X-Generator: grunt-wp-i18n 0.5.4\n"
+"X-Poedit-KeywordsList: "
+"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
+"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
+"Language: en\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-Country: United States\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+"X-Poedit-Basepath: ../\n"
+"X-Poedit-SearchPath-0: .\n"
+"X-Poedit-Bookmarks: \n"
+"X-Textdomain-Support: yes\n"
+
+#: view-all-posts-pages.php:147 view-all-posts-pages.php:154
+msgid "View All"
+msgstr ""
+
+#: view-all-posts-pages.php:437 view-all-posts-pages.php:466
+msgid "%s Options"
+msgstr ""
+
+#: view-all-posts-pages.php:468
+msgid ""
+"A \"view all\" link can be appended to WordPress' standard page navigation "
+"using the options below."
+msgstr ""
+
+#: view-all-posts-pages.php:472
+msgid "Automatically append link to post's page navigation?"
+msgstr ""
+
+#: view-all-posts-pages.php:474 view-all-posts-pages.php:510
+msgid "Yes"
+msgstr ""
+
+#: view-all-posts-pages.php:475 view-all-posts-pages.php:511
+msgid "No"
+msgstr ""
+
+#: view-all-posts-pages.php:479 view-all-posts-pages.php:531
+msgid "Link text:"
+msgstr ""
+
+#: view-all-posts-pages.php:485 view-all-posts-pages.php:537
+msgid "Link's CSS class(es):"
+msgstr ""
+
+#: view-all-posts-pages.php:489 view-all-posts-pages.php:541
+msgid ""
+"Be aware that Internet Explorer will only interpret the first two CSS "
+"classes."
+msgstr ""
+
+#: view-all-posts-pages.php:493 view-all-posts-pages.php:523
+msgid "Display automatically on:"
+msgstr ""
+
+#: view-all-posts-pages.php:502
+msgid "Standalone Link Options"
+msgstr ""
+
+#: view-all-posts-pages.php:504
+msgid ""
+"In addition to appending the \"view all\" link to WordPress' standard "
+"navigation, link(s) can be added above and below post content."
+msgstr ""
+
+#: view-all-posts-pages.php:508
+msgid "Automatically add links based on settings below?"
+msgstr ""
+
+#: view-all-posts-pages.php:515
+msgid "Automatically place link:"
+msgstr ""
+
+#: view-all-posts-pages.php:517
+msgid "Above content"
+msgstr ""
+
+#: view-all-posts-pages.php:518
+msgid "Below content"
+msgstr ""
+
+#: view-all-posts-pages.php:519
+msgid "Above and below content"
+msgstr ""
+
+#: view-all-posts-pages.php:545
+msgid "Link's priority:"
+msgstr ""
+
+#: view-all-posts-pages.php:549
+msgid ""
+"Priority determines when the link is added to a post's content. You can use "
+"the above setting to modulate the link's placement."
+msgstr ""
+
+#: view-all-posts-pages.php:550
+msgid ""
+"The default value is <strong>10</strong>. Lower values mean the link will "
+"be added earlier, while higher values will add the link later."
+msgstr ""
+
+#: view-all-posts-pages.php:689
+msgid "View All Post's Pages"
+msgstr ""
+
+#: view-all-posts-pages.php:691
+msgid ""
+"You must refresh your site's permalinks before <em>View All Post's "
+"Pages</em> is fully activated. To do so, go to <a "
+"href=\"%s\">Permalinks</a> and click the <strong><em>Save "
+"Changes</em></strong> button at the bottom of the screen."
+msgstr ""
+
+#: view-all-posts-pages.php:693
+msgid "When finished, click <a href=\"%s\">here</a> to hide this message."
+msgstr ""
+
+#. Plugin Name of the plugin/theme
+msgid "View All Posts Pages"
+msgstr ""
+
+#. Plugin URI of the plugin/theme
+msgid "http://www.oomphinc.com/plugins-modules/view-all-posts-pages/"
+msgstr ""
+
+#. Description of the plugin/theme
+msgid ""
+"Provides a \"view all\" (single page) option for posts, pages, and custom "
+"post types paged using WordPress' <a "
+"href=\"http://codex.wordpress.org/Write_Post_SubPanel#Quicktags\" "
+"target=\"_blank\"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> "
+"(multipage posts)."
+msgstr ""
+
+#. Author of the plugin/theme
+msgid "Erick Hitter & Oomph, Inc."
+msgstr ""
+
+#. Author URI of the plugin/theme
+msgid "http://www.oomphinc.com/"
+msgstr ""
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100755
index 0000000..10bf3ec
--- /dev/null
+++ b/package.json
@@ -0,0 +1,11 @@
+{
+  "name": "view-all-posts-pages",
+  "version": "0.1.0",
+  "main": "Gruntfile.js",
+  "author": "Erick Hitter & Oomph, Inc.",
+  "devDependencies": {
+    "grunt": "~0.4.5",
+    "grunt-wp-i18n": "~0.5.0",
+    "grunt-wp-readme-to-markdown": "~1.0.0"
+  }
+}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..16a3902
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<phpunit
+	bootstrap="tests/bootstrap.php"
+	backupGlobals="false"
+	colors="true"
+	convertErrorsToExceptions="true"
+	convertNoticesToExceptions="true"
+	convertWarningsToExceptions="true"
+	>
+	<testsuites>
+		<testsuite>
+			<directory prefix="test-" suffix=".php">./tests/</directory>
+			<exclude>./tests/test-sample.php</exclude>
+		</testsuite>
+	</testsuites>
+</phpunit>
diff --git a/readme.txt b/readme.txt
index d3a9dc0..1a84608 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Contributors: ethitter, thinkoomph
 Donate link: http://www.thinkoomph.com/plugins-modules/view-all-posts-pages/
 Tags: view all, pages, paged, paged post, multipage, single view, single page, wp_link_pages, nextpage, next page, quicktag
 Requires at least: 3.2.1
-Tested up to: 4.6
+Tested up to: 5.0
 Stable tag: 0.9.1
 License: GPLv2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100755
index 0000000..7dc0c88
--- /dev/null
+++ b/tests/bootstrap.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * PHPUnit bootstrap file
+ *
+ * @package View_All_Posts_Pages
+ */
+
+$_tests_dir = getenv( 'WP_TESTS_DIR' );
+
+if ( ! $_tests_dir ) {
+	$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
+}
+
+if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
+	echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // WPCS: XSS ok.
+	exit( 1 );
+}
+
+// Give access to tests_add_filter() function.
+require_once $_tests_dir . '/includes/functions.php';
+
+/**
+ * Manually load the plugin being tested.
+ */
+function _manually_load_plugin() {
+	require dirname( dirname( __FILE__ ) ) . '/view-all-posts-pages.php';
+}
+tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
+
+// Start up the WP testing environment.
+require $_tests_dir . '/includes/bootstrap.php';
diff --git a/tests/test-sample.php b/tests/test-sample.php
new file mode 100755
index 0000000..0c4fb88
--- /dev/null
+++ b/tests/test-sample.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Class SampleTest
+ *
+ * @package View_All_Posts_Pages
+ */
+
+/**
+ * Sample test case.
+ */
+class SampleTest extends WP_UnitTestCase {
+
+	/**
+	 * A single example test.
+	 */
+	public function test_sample() {
+		// Replace this with some actual testing code.
+		$this->assertTrue( true );
+	}
+}
diff --git a/view-all-posts-pages.php b/view-all-posts-pages.php
index 739dfef..dd2f7b6 100644
--- a/view-all-posts-pages.php
+++ b/view-all-posts-pages.php
@@ -1,27 +1,30 @@
 <?php
-/*
-Plugin Name: View All Post's Pages
-Plugin URI: http://www.oomphinc.com/plugins-modules/view-all-posts-pages/
-Description: Provides a "view all" (single page) option for posts, pages, and custom post types paged using WordPress' <a href="http://codex.wordpress.org/Write_Post_SubPanel#Quicktags" target="_blank"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> (multipage posts).
-Author: Erick Hitter & Oomph, Inc.
-Version: 0.9.1
-Author URI: http://www.oomphinc.com/
-Text Domain: view_all_posts_pages
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
+/**
+ * Plugin Name:     View All Posts Pages
+ * Plugin URI:      http://www.oomphinc.com/plugins-modules/view-all-posts-pages/
+ * Description:     Provides a "view all" (single page) option for posts, pages, and custom post types paged using WordPress' <a href="http://codex.wordpress.org/Write_Post_SubPanel#Quicktags" target="_blank"><code>&lt;!--nextpage--&gt;</code> Quicktag</a> (multipage posts).
+ * Author:          Erick Hitter & Oomph, Inc.
+ * Author URI:      http://www.oomphinc.com/
+ * Text Domain:     view_all_posts_pages
+ * Domain Path:     /languages
+ * Version:         0.9.1
+ *
+ * @package         View_All_Posts_Pages
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 
 class view_all_posts_pages {
 	/**
-- 
GitLab