$guide ) { vc_assert_same( array(), array_values( array_diff( array_keys( $guide ), array_keys( $fields ) ) ), "unknown fields for $slug" ); } } function test_bundled_guides_have_core_text() { foreach ( vc_test_bundled_guides() as $slug => $guide ) { foreach ( array( 'tagline', 'language', 'currency', 'timezone', 'about_title', 'about' ) as $key ) { vc_assert_same( true, ! empty( $guide[ $key ] ), "$slug.$key empty" ); } vc_assert_same( false, (bool) preg_match( '/elementor|\{|\}/', implode( ' ', $guide ) ), "$slug has page junk" ); } } function test_bundled_guides_cover_old_pages() { vc_assert_same( array( 'las-vegas', 'miami', 'montreal', 'new-orleans', 'new-york-city', 'vancouver' ), ( function ( $k ) { sort( $k ); return $k; } )( array_keys( vc_test_bundled_guides() ) ) ); } function test_empty_guide_detection() { $blank = array_fill_keys( array_keys( VC_City_Guide::fields() ), '' ); vc_assert_same( true, VC_City_Guide::is_empty( $blank ) ); vc_assert_same( true, VC_City_Guide::is_empty( array_merge( $blank, array( 'southern' => true, 'about_image' => 'https://x/y.jpg' ) ) ) ); vc_assert_same( false, VC_City_Guide::is_empty( array_merge( $blank, array( 'winter' => 'Skate.' ) ) ) ); } function test_season_months_flip_south() { $north = VC_City_Guide::season_months( false ); $south = VC_City_Guide::season_months( true ); vc_assert_same( 'March – May', $north['spring'] ); vc_assert_same( 'September – November', $south['spring'] ); vc_assert_same( 'June – August', $south['winter'] ); }