blob: 06f432352652fed4069c5f6800c734bf9bf7b873 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
namespace Civi\Test\Api4\Traits;
trait OptionCleanupTrait {
protected $optionGroupMaxId;
protected $optionValueMaxId;
public function setUp() {
$this->optionGroupMaxId = \CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_option_group');
$this->optionValueMaxId = \CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_option_value');
}
public function tearDown() {
if ($this->optionValueMaxId) {
\CRM_Core_DAO::executeQuery('DELETE FROM civicrm_option_value WHERE id > ' . $this->optionValueMaxId);
}
if ($this->optionGroupMaxId) {
\CRM_Core_DAO::executeQuery('DELETE FROM civicrm_option_group WHERE id > ' . $this->optionGroupMaxId);
}
}
}
|