Assets/Block settings: Only lookup page if ID > 0 (https://github.com/woocommerce/woocommerce-blocks/pull/2369)
* Only lookup page if ID > 0 * Check for valid post * Maybe fix test path
This commit is contained in:
parent
bf8cff6f50
commit
a640a230ca
|
@ -163,10 +163,10 @@ class Assets {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected static function format_page_resource( $page ) {
|
protected static function format_page_resource( $page ) {
|
||||||
if ( is_numeric( $page ) ) {
|
if ( is_numeric( $page ) && $page > 0 ) {
|
||||||
$page = get_post( $page );
|
$page = get_post( $page );
|
||||||
}
|
}
|
||||||
if ( ! $page ) {
|
if ( ! is_a( $page, '\WP_Post' ) ) {
|
||||||
return [
|
return [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'title' => '',
|
'title' => '',
|
||||||
|
|
|
@ -56,7 +56,7 @@ function wc_blocks_install() {
|
||||||
* Adds WooCommerce testing framework classes.
|
* Adds WooCommerce testing framework classes.
|
||||||
*/
|
*/
|
||||||
function wc_test_includes() {
|
function wc_test_includes() {
|
||||||
$wc_tests_framework_base_dir = wc_dir() . '/tests';
|
$wc_tests_framework_base_dir = wc_dir() . '/tests/legacy';
|
||||||
// WooCommerce test classes.
|
// WooCommerce test classes.
|
||||||
// Framework.
|
// Framework.
|
||||||
require_once $wc_tests_framework_base_dir . '/framework/class-wc-unit-test-factory.php';
|
require_once $wc_tests_framework_base_dir . '/framework/class-wc-unit-test-factory.php';
|
||||||
|
|
Loading…
Reference in New Issue