Use new code style
This commit is contained in:
@ -18,23 +18,23 @@ defined('ABSPATH') || exit;
|
||||
*/
|
||||
function wu_mock_site($seed = false) {
|
||||
|
||||
$atts = apply_filters('wu_mock_site', array(
|
||||
'title' => __('Example Site', 'wp-ultimo'),
|
||||
'description' => __('This is an example of a site description.', 'wp-ultimo'),
|
||||
'domain' => __('examplesite.dev', 'wp-ultimo'),
|
||||
'path' => '/',
|
||||
));
|
||||
$atts = apply_filters(
|
||||
'wu_mock_site',
|
||||
array(
|
||||
'title' => __('Example Site', 'wp-ultimo'),
|
||||
'description' => __('This is an example of a site description.', 'wp-ultimo'),
|
||||
'domain' => __('examplesite.dev', 'wp-ultimo'),
|
||||
'path' => '/',
|
||||
)
|
||||
);
|
||||
|
||||
if ($seed) {
|
||||
|
||||
$atts['title'] .= " {$seed}";
|
||||
$atts['domain'] = str_replace('.dev', "{$seed}.dev", (string) $atts['domain']);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return new \WP_Ultimo\Models\Site($atts);
|
||||
|
||||
} // end wu_mock_site;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock membership object.
|
||||
@ -44,14 +44,17 @@ function wu_mock_site($seed = false) {
|
||||
*/
|
||||
function wu_mock_membership() {
|
||||
|
||||
return new \WP_Ultimo\Models\Membership(array(
|
||||
'billing_address' => new \WP_Ultimo\Objects\Billing_Address(array(
|
||||
'company_name' => 'Company Co.',
|
||||
'billing_email' => 'company@co.dev',
|
||||
)),
|
||||
));
|
||||
|
||||
} // end wu_mock_membership;
|
||||
return new \WP_Ultimo\Models\Membership(
|
||||
array(
|
||||
'billing_address' => new \WP_Ultimo\Objects\Billing_Address(
|
||||
array(
|
||||
'company_name' => 'Company Co.',
|
||||
'billing_email' => 'company@co.dev',
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock product object.
|
||||
@ -61,15 +64,16 @@ function wu_mock_membership() {
|
||||
*/
|
||||
function wu_mock_product() {
|
||||
|
||||
$product = new \WP_Ultimo\Models\Product(array(
|
||||
'name' => __('Test Product', 'wp-ultimo'),
|
||||
));
|
||||
$product = new \WP_Ultimo\Models\Product(
|
||||
array(
|
||||
'name' => __('Test Product', 'wp-ultimo'),
|
||||
)
|
||||
);
|
||||
|
||||
$product->_mocked = true;
|
||||
|
||||
return $product;
|
||||
|
||||
} // end wu_mock_product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock customer object.
|
||||
@ -79,12 +83,16 @@ function wu_mock_product() {
|
||||
*/
|
||||
function wu_mock_customer() {
|
||||
|
||||
$customer = new \WP_Ultimo\Models\Customer(array(
|
||||
'billing_address' => new \WP_Ultimo\Objects\Billing_Address(array(
|
||||
'company_name' => 'Company Co.',
|
||||
'billing_email' => 'company@co.dev',
|
||||
)),
|
||||
));
|
||||
$customer = new \WP_Ultimo\Models\Customer(
|
||||
array(
|
||||
'billing_address' => new \WP_Ultimo\Objects\Billing_Address(
|
||||
array(
|
||||
'company_name' => 'Company Co.',
|
||||
'billing_email' => 'company@co.dev',
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$customer->_user = (object) array(
|
||||
'data' => (object) array(
|
||||
@ -104,8 +112,7 @@ function wu_mock_customer() {
|
||||
);
|
||||
|
||||
return $customer;
|
||||
|
||||
} // end wu_mock_customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock payment object.
|
||||
@ -117,17 +124,20 @@ function wu_mock_payment() {
|
||||
|
||||
$payment = new \WP_Ultimo\Models\Payment();
|
||||
|
||||
$line_item = new \WP_Ultimo\Checkout\Line_Item(array(
|
||||
'product' => wu_mock_product(),
|
||||
));
|
||||
$line_item = new \WP_Ultimo\Checkout\Line_Item(
|
||||
array(
|
||||
'product' => wu_mock_product(),
|
||||
)
|
||||
);
|
||||
|
||||
$payment->set_line_items(array(
|
||||
$line_item,
|
||||
));
|
||||
$payment->set_line_items(
|
||||
array(
|
||||
$line_item,
|
||||
)
|
||||
);
|
||||
|
||||
return $payment;
|
||||
|
||||
} // end wu_mock_payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock domain object.
|
||||
@ -137,15 +147,16 @@ function wu_mock_payment() {
|
||||
*/
|
||||
function wu_mock_domain() {
|
||||
|
||||
$domain = new \WP_Ultimo\Models\Domain(array(
|
||||
'blog_id' => 1,
|
||||
'domain' => 'example.com',
|
||||
'active' => true,
|
||||
'primary_domain' => true,
|
||||
'secure' => true,
|
||||
'stage' => 'checking-dns',
|
||||
));
|
||||
$domain = new \WP_Ultimo\Models\Domain(
|
||||
array(
|
||||
'blog_id' => 1,
|
||||
'domain' => 'example.com',
|
||||
'active' => true,
|
||||
'primary_domain' => true,
|
||||
'secure' => true,
|
||||
'stage' => 'checking-dns',
|
||||
)
|
||||
);
|
||||
|
||||
return $domain;
|
||||
|
||||
} // end wu_mock_domain;
|
||||
}
|
||||
|
Reference in New Issue
Block a user