Changeset 1322567
- Timestamp:
- 01/06/2016 06:18:00 PM (10 years ago)
- Location:
- bu-navigation/trunk
- Files:
-
- 11 edited
-
bin/install-wp-tests.sh (modified) (4 diffs)
-
bu-navigation-widget.php (modified) (1 diff)
-
bu-navigation.php (modified) (2 diffs)
-
composer.json (modified) (1 diff)
-
extras/bu-navigation-adaptive-contentnav.php (modified) (1 diff)
-
includes/library.php (modified) (2 diffs)
-
languages/bu-navigation.pot (modified) (1 diff)
-
package.json (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
tests/phpunit/test-library.php (modified) (2 diffs)
-
tests/phpunit/test-plugin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bu-navigation/trunk/bin/install-wp-tests.sh
r1048298 r1322567 13 13 14 14 WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib} 15 WP_CORE_DIR=/tmp/wordpress/ 15 WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/} 16 17 download() { 18 if [ `which curl` ]; then 19 curl -s "$1" > "$2"; 20 elif [ `which wget` ]; then 21 wget -nv -O "$2" "$1" 22 fi 23 } 24 25 if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then 26 WP_TESTS_TAG="tags/$WP_VERSION" 27 else 28 # http serves a single offer, whereas https serves multiple. we only want one 29 download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json 30 grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json 31 LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') 32 if [[ -z "$LATEST_VERSION" ]]; then 33 echo "Latest WordPress version could not be found" 34 exit 1 35 fi 36 WP_TESTS_TAG="tags/$LATEST_VERSION" 37 fi 16 38 17 39 set -ex 18 40 19 41 install_wp() { 42 43 if [ -d $WP_CORE_DIR ]; then 44 return; 45 fi 46 20 47 mkdir -p $WP_CORE_DIR 21 48 22 if [ $WP_VERSION == 'latest' ]; then 49 if [ $WP_VERSION == 'latest' ]; then 23 50 local ARCHIVE_NAME='latest' 24 51 else … … 26 53 fi 27 54 28 wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz55 download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz 29 56 tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR 30 57 31 wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php58 download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php 32 59 } 33 60 … … 40 67 fi 41 68 42 # set up testing suite 43 mkdir -p $WP_TESTS_DIR 69 # set up testing suite if it doesn't yet exist 70 if [ ! -d $WP_TESTS_DIR ]; then 71 # set up testing suite 72 mkdir -p $WP_TESTS_DIR 73 svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes 74 fi 75 44 76 cd $WP_TESTS_DIR 45 svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/46 77 47 wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php 48 sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php 49 sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php 50 sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php 51 sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php 52 sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php 78 if [ ! -f wp-tests-config.php ]; then 79 download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php 80 sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php 81 sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php 82 sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php 83 sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php 84 sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php 85 fi 86 53 87 } 54 88 … … 61 95 62 96 if ! [ -z $DB_HOSTNAME ] ; then 63 if [ [ "$DB_SOCK_OR_PORT" =~ ^[0-9]+$ ]]; then97 if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then 64 98 EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" 65 99 elif ! [ -z $DB_SOCK_OR_PORT ] ; then -
bu-navigation/trunk/bu-navigation-widget.php
r1225359 r1322567 51 51 if ( $instance['navigation_style'] == 'adaptive' ) { 52 52 $grandparent_offset = count( $sections ) - 2; 53 54 // If the current page is the last item, go up one further 55 if( end( $sections ) == $post->ID ){ 56 $grandparent_offset--; 57 } 58 53 59 if ( isset( $sections[$grandparent_offset] ) ) { 54 60 $section_id = $sections[$grandparent_offset]; -
bu-navigation/trunk/bu-navigation.php
r1225359 r1322567 6 6 Author URI: http://sites.bu.edu/web/ 7 7 Description: Provides alternative navigation elements designed for blogs with large page counts 8 Version: 1.2. 78 Version: 1.2.8 9 9 Text Domain: bu-navigation 10 10 Domain Path: /languages … … 35 35 @author Mike Burns <[email protected]> 36 36 @author Tyler Wiest <[email protected]> 37 @author Andrew Bauer <[email protected]> 37 38 */ 38 39 -
bu-navigation/trunk/composer.json
r1048298 r1322567 19 19 "name": "Tyler Wiest", 20 20 "email": "[email protected]" 21 }, 22 { 23 "name": "Andrew Bauer", 24 "email": "[email protected]" 21 25 } 22 26 ], -
bu-navigation/trunk/extras/bu-navigation-adaptive-contentnav.php
r766271 r1322567 87 87 return $filtered; 88 88 } 89 90 ?> -
bu-navigation/trunk/includes/library.php
r1048298 r1322567 361 361 // Append parent post name and keep looping backwards. 362 362 $parent = $ancestors[ $page->post_parent ]; 363 if ( is_object( $parent ) && isset( $parent->post_name ) ) {363 if ( is_object( $parent ) && ! empty( $parent->post_name ) ) { 364 364 $uri = $parent->post_name . '/' . $uri; 365 365 } … … 888 888 array_push( $sections, $last_section ); 889 889 890 if ( is_array( $pages_by_parent[$last_section] ) && ( count( $pages_by_parent[$last_section] ) > 0 ) ) { 890 if ( array_key_exists( $last_section, $pages_by_parent ) && 891 is_array( $pages_by_parent[$last_section] ) && 892 ( count( $pages_by_parent[$last_section] ) > 0 ) 893 ) { 891 894 // The last section has children, so it will be the "top" 892 895 $sections = array_slice($sections, -2); -
bu-navigation/trunk/languages/bu-navigation.pot
r1225359 r1322567 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: bu-navigation 1.2. 7\n"5 "Project-Id-Version: bu-navigation 1.2.8\n" 6 6 "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/bu-navigation\n" 7 7 "POT-Creation-Date: 2015-08-19 12:32-0400\n" -
bu-navigation/trunk/package.json
r1225359 r1322567 1 1 { 2 2 "name": "bu-navigation", 3 "version": "1.2. 7",3 "version": "1.2.8", 4 4 "description": "Provides alternative navigation elements designed for blogs with large page counts", 5 5 "main": "bu-navigation.php", -
bu-navigation/trunk/readme.txt
r1225359 r1322567 3 3 Tags: navigation, hierarchical, post type, boston university, bu 4 4 Requires at least: 3.1 5 Tested up to: 4. 36 Stable tag: 1.2. 75 Tested up to: 4.4 6 Stable tag: 1.2.8 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 76 76 77 77 == Changelog == 78 79 = 1.2.8 = 80 81 * Fixes an issue affecting section titles in the navigation widget when using Adaptive Mode 82 * Corrects invalid unit tests 78 83 79 84 = 1.2.7 = -
bu-navigation/trunk/tests/phpunit/test-library.php
r1146690 r1322567 431 431 // Non-Page Hierarchical Post Type 'Default Permalinks' do not work for child posts prior to 4.0 432 432 // @see https://core.trac.wordpress.org/ticket/29615 433 if ( $wp_rewrite->using_permalinks() || version_compare( $GLOBALS['wp_version'], '4.0', '>' ) ) {433 if ( $wp_rewrite->using_permalinks() && version_compare( $GLOBALS['wp_version'], '4.4', '>=' ) ) { 434 434 $grandchild = $this->posts['test_grandchild']; 435 435 $grandchild = get_post( $grandchild ); … … 471 471 $this->assertEquals( get_post_permalink( $pending_child ), bu_navigation_get_post_link( $pending_child ) ); 472 472 473 // Non-Page Hierarchical Post Type 'Default Permalinks' do not work for child posts prior to 4.0 473 // #29615: Non-Page Hierarchical Post Type 'Default Permalinks' do not work for child posts prior to 4.0. 474 // #23458: get_post_permalink() improved in v4.4 to fix incorrect URLs for pages when child of a draft (e.g. http://example.org/test//post-title-5/) 474 475 // @see https://core.trac.wordpress.org/ticket/29615 475 if ( $wp_rewrite->using_permalinks() || version_compare( $GLOBALS['wp_version'], '4.0', '>' ) ) { 476 // @see https://core.trac.wordpress.org/ticket/23458 477 if ( $wp_rewrite->using_permalinks() && version_compare( $GLOBALS['wp_version'], '4.4', '>=' ) ) { 476 478 // Draft parent, public children 477 479 $this->assertEquals( get_post_permalink( $public_draft_child ), bu_navigation_get_post_link( $public_draft_child ) ); -
bu-navigation/trunk/tests/phpunit/test-plugin.php
r1048298 r1322567 8 8 */ 9 9 class Test_BU_Navigation_Plugin extends BU_Navigation_UnitTestCase { 10 11 public function setUp(){ 12 parent::setUp(); 13 14 $this->plugin->load_widget(); 15 } 10 16 11 17 /** … … 50 56 } 51 57 58 public function test_widget_adaptive_with_section_title(){ 59 global $wp_widget_factory, 60 $post; 61 62 /* 63 * IA 64 * - Page 1 65 * - Subpage 1.A 66 * - Subpage 1.A.1 (widget loaded here) 67 * - Subpage 1.A.1.A (excluded from nav) 68 * - Subpage 1.A.2 69 */ 70 71 $page1 = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Page 1', ) ); 72 $page1_A = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Subpage 1-A', 'post_parent' => $page1 ) ); 73 $page1_A_1 = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Subpage 1-A-1 (Has Child)', 'post_parent' => $page1_A ) ); 74 $page1_A_1_A = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Subpage 1-A-1-A', 'post_parent' => $page1_A_1 ) ); 75 $page1_A_2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Subpage 1-A-2 (No Child)', 'post_parent' => $page1_A ) ); 76 77 // make sure we've got everyone 78 $posts = bu_navigation_get_posts(); 79 $this->assertCount( 5, $posts ); 80 81 // set page1_A_1_A to hidden in nav 82 update_post_meta( $page1_A_1_A, BU_NAV_META_PAGE_EXCLUDE, 1 ); 83 84 // make sure we're missing page1_A_1 85 $posts = bu_navigation_get_posts(); 86 $this->assertCount( 4, $posts ); 87 88 // load persepctive of page page1_A_1 89 $post = get_post( $page1_A_1 ); 90 setup_postdata( $post ); 91 92 $instance = array( 93 'navigation_title' => 'section', 94 'navigation_title_text' => '', 95 'navigation_title_url' => '', 96 'navigation_style' => 'adaptive', 97 ); 98 99 ob_start(); 100 the_widget( 'BU_Widget_Pages', $instance ); 101 $widget = ob_get_contents(); 102 ob_end_clean(); 103 // echo $widget; 104 105 $this->assertRegExp('/<h2.+Page 1<\/a>/i', $widget); 106 $this->assertRegExp('/class="level_1".+Subpage 1-A<\/a>/is', $widget); 107 } 108 52 109 }
Note: See TracChangeset
for help on using the changeset viewer.