protected function AjaxTest::addPaymentZoneCondition in Ubercart 8.4
Sets a zone-based condition for a particular payment method.
Parameters
string $method: The method to set (e.g. 'check')
int $zone: The zone id (numeric) to check for.
bool $negate: TRUE to negate the condition.
File
- uc_store/
tests/ src/ FunctionalJavascript/ AjaxTest.php, line 58
Class
- AjaxTest
- Tests Ajax updating of checkout and order pages.
Namespace
Drupal\Tests\uc_store\FunctionalJavascriptCode
protected function addPaymentZoneCondition($method, $zone, $negate = FALSE) {
$not = $negate ? 'NOT ' : '';
$name = 'uc_payment_method_' . $method;
$label = ucfirst($method) . ' conditions';
$condition = [
'LABEL' => $label,
'PLUGIN' => 'and',
'REQUIRES' => [
'rules',
],
'USES VARIABLES' => [
'order' => [
'label' => 'Order',
'type' => 'uc_order',
],
],
'AND' => [
[
$not . 'data_is' => [
'data' => [
'order:billing-address:zone',
],
'value' => $zone,
],
],
],
];
$newconfig = rules_import([
$name => $condition,
]);
$oldconfig = rules_config_load($name);
if ($oldconfig) {
$newconfig->id = $oldconfig->id;
unset($newconfig->is_new);
$newconfig->status = ENTITY_CUSTOM;
}
$newconfig
->save();
entity_flush_caches();
//$this->drupalGet('admin/config/workflow/rules/components/edit/' . $newconfig->id);
}