Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Start tests

  • Loading branch information...
commit 76b3ab4a3debee8522c93702160f9e9eba29b743 1 parent a370c20
@andrewryno authored
View
35 .travis.yml
@@ -0,0 +1,35 @@
+language: php
+
+php:
+ - 5.3
+ - 5.4
+
+env:
+ - WP_VERSION=master WP_MULTISITE=0
+ - WP_VERSION=master WP_MULTISITE=1
+ - WP_VERSION=3.5.1 WP_MULTISITE=0
+ - WP_VERSION=3.5.1 WP_MULTISITE=1
+
+before_install:
+ - git submodule update --init --recursive
+
+before_script:
+ # set up WP install
+ - WP_CORE_DIR=/tmp/wordpress/
+ - mkdir -p $WP_CORE_DIR
+ - wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION
+ - tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
+ # set up testing suite
+ - export WP_TESTS_DIR=/tmp/wordpress-tests/
+ - svn co --ignore-externals --quiet http://unit-tests.svn.wordpress.org/trunk/ $WP_TESTS_DIR
+ - cd $WP_TESTS_DIR
+ - cp wp-tests-config-sample.php wp-tests-config.php
+ - sed -i "s:dirname( __FILE__ ) . '/wordpress/':'$WP_CORE_DIR':" wp-tests-config.php
+ - sed -i "s/yourdbnamehere/wordpress_test/" wp-tests-config.php
+ - sed -i "s/yourusernamehere/root/" wp-tests-config.php
+ - sed -i "s/yourpasswordhere//" wp-tests-config.php
+ - cd -
+ # set up database
+ - mysql -e 'CREATE DATABASE wordpress_test;' -uroot
+
+script: phpunit
View
14 phpunit.xml
@@ -0,0 +1,14 @@
+<phpunit
+ bootstrap="tests/bootstrap.php"
+ backupGlobals="false"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ >
+ <testsuites>
+ <testsuite>
+ <directory prefix="test-" suffix=".php">./tests/</directory>
+ </testsuite>
+ </testsuites>
+</phpunit>
View
11 tests/bootstrap.php
@@ -0,0 +1,11 @@
+<?php
+
+require_once getenv( 'WP_TESTS_DIR' ) . '/includes/functions.php';
+
+function _manually_load_plugin() {
+ require dirname( __FILE__ ) . '/../unique-page-sidebars.php';
+}
+tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
+
+require getenv( 'WP_TESTS_DIR' ) . '/includes/bootstrap.php';
+
View
17 tests/test-unique-page-sidebars.php
@@ -0,0 +1,17 @@
+<?php
+
+class UniquePageSidebarsTest extends WP_UnitTestCase {
+
+ public function setUp() {
+ parent::setUp();
+ $this->plugin = $GLOBALS['unique_page_sidebars'];
+ }
+
+ /**
+ * Make sure that our ups_filter is being loaded.
+ */
+ public function testFilters() {
+ $this->assertTrue( has_filter( 'ups_sidebar' ) );
+ }
+
+}
View
2  unique-page-sidebars.php
@@ -353,4 +353,4 @@ public function about() {
}
-$unique_page_sidebars = new Unique_Page_Sidebars;
+$GLOBALS['unique_page_sidebars'] = new Unique_Page_Sidebars;
Please sign in to comment.
Something went wrong with that request. Please try again.