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

Fix broken tests in PHP 5.5 #1293

Merged
merged 3 commits into from
Sep 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 14 additions & 2 deletions inc/related-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,20 @@ protected function get_series_posts() {
*/
protected function get_term_posts() {

//we've gone back and forth through all the post's series, now let's try traditional taxonomies
$taxonomies = get_the_terms( $this->post_id, array( 'category', 'post_tag' ) );
//we've gone back and forth through all the post's series, now let's try traditional taxonomies
$taxonomies = array();
foreach ( array( 'categories', 'tags' ) as $_taxonomy ) {
$_terms = get_object_term_cache( $this->post_id, $_taxonomy );

if ( false === $_terms ) {
$_terms = wp_get_object_terms( $this->post_id, $_taxonomy );
wp_cache_add( $this->post_id, $taxonomies, $_taxonomy . '_relationships' );
}

if ( is_array( $_terms ) ) {
$taxonomies = array_merge( $taxonomies, $_terms );
}
}

//loop thru taxonomies, much like series, and get posts
if ( is_array($taxonomies) ) {
Expand Down
3 changes: 2 additions & 1 deletion inc/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ function largo_set_new_option_defaults() {
* Make sure custom CSS is regenerated if we're using custom LESS variables
*/
function largo_update_custom_less_variables() {
if (Largo::is_less_enabled()) {
$largo = Largo::get_instance();
if ( $largo->is_less_enabled() ) {
$variables = Largo_Custom_Less_Variables::get_custom_values();
$escaped = array();

Expand Down
1 change: 0 additions & 1 deletion tests/inc/test-related-content.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

// Test functions in inc/related-content.php

class RelatedContentTestFunctions extends wp_UnitTestCase{
function setUp() {
parent::setUp();
Expand Down
5 changes: 5 additions & 0 deletions tests/inc/test-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ function test_largo_transition_nav_menus() {
}

function test_largo_update_prominence_term_description_single() {
$term9 = get_term_by('slug', 'term-9', 'prominence', 'ARRAY_A');
if ( ! $term9 ) {
wp_insert_term( 'term-9', 'prominence', array( 'description' => 'Term Description 9' ) );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have to create this term; it should have been created by this class' setUp method: https://github.com/rclations/Largo/blob/a773c5a2cfdbb7706c41085e8388f0d83b583e8e/tests/inc/test-update.php#L29-L31

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous comment might be wrong, based on #1209 (comment)

Either way, the test tests what it's supposed to test.

}

$update = array(
'name' => 'Term 9',
'description' => 'Term 9 From Outer Space',
Expand Down