Fix PHP notice in Tests_Feed_RSS2::test_items()
.
A notice was being thrown when `get_the_tags()` returned false, and `foreach()` was run over that return value. See [30283]. git-svn-id: https://develop.svn.wordpress.org/trunk@30295 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d011f4ef00
commit
3c360968ef
@ -125,9 +125,13 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase {
|
|||||||
foreach ( get_the_category( $post->ID ) as $term ) {
|
foreach ( get_the_category( $post->ID ) as $term ) {
|
||||||
$cats[] = $term->name;
|
$cats[] = $term->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tags = get_the_tags( $post->ID );
|
||||||
|
if ( $tags ) {
|
||||||
foreach ( get_the_tags( $post->ID ) as $term ) {
|
foreach ( get_the_tags( $post->ID ) as $term ) {
|
||||||
$cats[] = $term->name;
|
$cats[] = $term->name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$cats = array_filter( $cats );
|
$cats = array_filter( $cats );
|
||||||
// should be the same number of categories
|
// should be the same number of categories
|
||||||
$this->assertEquals( count( $cats ), count( $categories ) );
|
$this->assertEquals( count( $cats ), count( $categories ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user