Skip to content

Commit

Permalink
Fix phpunit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Bengtsson committed Jan 26, 2017
1 parent 7f8b706 commit 3883f5a
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 334 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
node_modules/
imgix_plugin-*.zip
.DS_Store
/vendor/
/composer.lock
17 changes: 15 additions & 2 deletions .travis.yml
@@ -1,4 +1,15 @@
language: php

sudo: false

install:
- travis_retry composer self-update
- travis_retry composer install --no-interaction --prefer-source

cache:
directories:
- $HOME/.composer/cache

matrix:
include:
- php: 5.5.9
Expand All @@ -11,6 +22,8 @@ matrix:
env: WP_VERSION=latest WP_MULTISITE=0
- php: 7.0
env: WP_VERSION=nightly WP_MULTISITE=0

before_script:
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
script: phpunit
- bash vendor/frozzare/wp-test-suite/bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 $WP_VERSION

script: vendor/bin/phpunit
98 changes: 0 additions & 98 deletions bin/install-wp-tests.sh

This file was deleted.

20 changes: 20 additions & 0 deletions composer.json
@@ -0,0 +1,20 @@
{
"name": "imgix-wordpress/imgix-wordpress",
"type": "wordpress-plugin",
"license": "BSD-2.0",
"description": "imgix WordPress plugin",
"homepage": "https://github.com/imgix-wordpress/imgix-wordpress",
"keywords": [
"wordpress",
"wordpress-plugin",
"imgix"
],
"require": {
"php": "^5.5.9 || ^7.0"
},
"require-dev": {
"frozzare/wp-test-suite": "^1.0"
},
"minimum-stability": "dev",
"prefer-stable": true
}
33 changes: 23 additions & 10 deletions phpunit.xml
@@ -1,14 +1,27 @@
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="false"
convertWarningsToExceptions="true"
>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite>
<directory prefix="test-" suffix=".php">./tests/</directory>
<testsuite name="WP imgix Test Suite">
<directory suffix=".php">./tests/cases</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
17 changes: 6 additions & 11 deletions tests/bootstrap.php
@@ -1,15 +1,10 @@
<?php

$_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) {
$_tests_dir = '/tmp/wordpress-tests-lib';
}
// Load Composer autoload.
require __DIR__ . '/../vendor/autoload.php';

require_once $_tests_dir . '/includes/functions.php';
// Load Papi loader file as plugin.
WP_Test_Suite::load_plugins( __DIR__ . '/../imgix.php' );

function _manually_load_plugin() {
require dirname( dirname( __FILE__ ) ) . '/plugin/imgix.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

require $_tests_dir . '/includes/bootstrap.php';
// Run the WordPress test suite.
WP_Test_Suite::run();

0 comments on commit 3883f5a

Please sign in to comment.