Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/updated unit tests #56

Merged
merged 54 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
014ce5e
initial commit for switching from WP_Mock to core WP tests
petenelson Oct 5, 2018
c865f9c
added tests for is_ip()
petenelson Oct 5, 2018
c645f85
updated tests for is_ip():
petenelson Oct 5, 2018
0bba7ff
added test for ip_in_range()
petenelson Oct 5, 2018
8881f3a
added test for get_client_ip_address()
petenelson Oct 5, 2018
2a52862
updated travis yml
petenelson Oct 5, 2018
32de4f1
added test_activation()
petenelson Oct 5, 2018
e650eb2
updated travis yml
petenelson Oct 5, 2018
188c0cd
added test_deactivation()
petenelson Oct 5, 2018
8770d42
added multisite config
petenelson Oct 5, 2018
e5df35d
updated travis yml
petenelson Oct 5, 2018
b39da6e
updated travis yml
petenelson Oct 5, 2018
4b44929
refactored tests for activation and deactivation
petenelson Oct 5, 2018
13c187d
added test_get_options
petenelson Oct 5, 2018
c870b43
initial work on refactoring restrict_access_check to be testable and …
petenelson Oct 5, 2018
331353b
initial work on testing restricted access
petenelson Oct 5, 2018
d62b129
added test for whitelisted IP
petenelson Oct 5, 2018
73f36f3
refactored whitelisted IP tests
petenelson Oct 8, 2018
e750812
added test_restrict_access_show_them_a_page(), fixed a redirect loop …
petenelson Oct 9, 2018
76b7d71
updated travis yml
petenelson Oct 9, 2018
64e40a6
added test_restrict_access_show_them_a_message() and refactored the c…
petenelson Oct 9, 2018
4a73929
small test updates
petenelson Oct 9, 2018
a13c934
small test updates
petenelson Oct 9, 2018
b8efedf
moved restriction tests into new folders
petenelson Oct 10, 2018
a477e16
initial work on code coverage
petenelson Oct 10, 2018
9b0c8c1
refactored some tests into separate folders
petenelson Oct 10, 2018
9ed688e
defined plugin root
petenelson Oct 10, 2018
079abea
added is_network() check
petenelson Oct 10, 2018
4c5511b
Added test_multisite_restrict_access_not_restricted
petenelson Oct 10, 2018
85cb09e
added test_multiesite_restrict_access_restricted_default
petenelson Oct 10, 2018
2a6423b
added some codeCoverageIgnore directives
petenelson Oct 10, 2018
b5c7208
added logged-in tests
petenelson Oct 10, 2018
f060564
added test_singlesite_restrict_access_redirect_to_url
petenelson Oct 10, 2018
a7b13f6
added tests for get_config_ips()
petenelson Oct 10, 2018
f30732b
added uninstall tests
petenelson Oct 10, 2018
c850007
added Restricted_Site_Access_Test_Actions
petenelson Oct 10, 2018
aaa2843
added test_multisite_save_network_settings
petenelson Oct 10, 2018
5b68655
added test_set_defaults
petenelson Oct 10, 2018
8c42841
added admin_init tests
petenelson Oct 11, 2018
37062a7
added test_privacy_link_filters
petenelson Oct 11, 2018
2aa4e14
added test_load_network_settings_page
petenelson Oct 11, 2018
341a1ee
added tests for show_network_settings()
petenelson Oct 11, 2018
d975c20
added test_enqueue_admin_script
petenelson Oct 11, 2018
cd9d1a0
added test_settings_field_allowed
petenelson Oct 11, 2018
ef0cf11
added test_filter_page_dropdown
petenelson Oct 11, 2018
f72b2ee
added test_admin_notice
petenelson Oct 11, 2018
b2ebc05
added test_multisite_page_cache_notice
petenelson Oct 11, 2018
a280f9a
updated page cache notice tests
petenelson Oct 11, 2018
94e9eae
added test_plugin_action_links
petenelson Oct 11, 2018
57bbc5c
added test_settings_field_rsa_page
petenelson Oct 11, 2018
2b890b1
added test_blog_privacy_selector
petenelson Oct 12, 2018
9262427
added test_admin_head
petenelson Oct 12, 2018
630b332
removed unused helper file
petenelson Oct 12, 2018
373c6b1
Merge branch 'develop' into feature/updated-unit-tests
petenelson Feb 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
vendor
vendor
test-coverage
41 changes: 35 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,51 @@ language: php
sudo: false

php:
- 7.2
- 7.0

matrix:
fast_finish: true

cache:
apt: true
directories:
- node_modules
- vendor

install:
- composer install --no-interaction
- npm install

matrix:
fast_finish: true
# Declare which versions of WordPress to test against.
env:
- WP_VERSION=master

services:
- mysql

# Use this to prepare your build for testing.
# e.g. copy database configurations, environment variables, etc.
# Failures in this section will result in build status 'errored'.
before_script:
- pwd
# Set up WordPress installation.
- export WP_DEVELOP_DIR=/tmp/wordpress/
- mkdir -p $WP_DEVELOP_DIR
# Use the Git mirror of WordPress.
- git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR
# Set up WordPress configuration.
- cd $WP_DEVELOP_DIR
- echo $WP_DEVELOP_DIR
- cp wp-tests-config-sample.php wp-tests-config.php
- sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php
- sed -i "s/yourusernamehere/root/" wp-tests-config.php
- sed -i "s/yourpasswordhere//" wp-tests-config.php
# Create WordPress database.
- mysql -e 'CREATE DATABASE wordpress_test;' -uroot
# Switch back to the plugin dir
- cd $TRAVIS_BUILD_DIR

script:
- grunt phpunit
- mkdir test-coverage
- phpunit --verbose
- phpunit --verbose -c tests/php/multisite/multisite.xml
- phpunit --verbose -c tests/php/whitelist/whitelist.xml
# TODO combine the test coverage into one file and ship it to Code Climate or Coveralls?
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"require-dev": {
"phpunit/phpunit": "^6.5.6",
"10up/wp_mock": "^0.3.0"
"phpunit/phpunit": "^6.5.6"
}
}
76 changes: 0 additions & 76 deletions phpunit-bootstrap.php

This file was deleted.

28 changes: 28 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<phpunit
bootstrap="tests/php/bootstrap.php"
backupGlobals="false"
colors="true"
verbose="true"
>
<testsuites>
<testsuite name="restricted-site-access-unit-tests">
<directory suffix=".php">tests/php</directory>
<exclude>tests/php/code-coverage.php</exclude>
<exclude suffix=".php">tests/php/multisite</exclude>
<exclude suffix=".php">tests/php/whitelist</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist>
<file>restricted_site_access.php</file>
</whitelist>
</filter>
<php>
<ini name="error_reporting" value="32767" />
<ini name="display_errors" value="1" />
<ini name="display_startup_errors" value="1" />
</php>
<logging>
<log type="coverage-php" target="test-coverage/coverage.serialized"/>
</logging>
</phpunit>
Loading