Skip to content

Commit

Permalink
Merge pull request #23959 from totten/master-casexml-acttype
Browse files Browse the repository at this point in the history
(NFC) case-xml@1 - Add example+assertions of new activity-type
  • Loading branch information
eileenmcnaughton authored Jul 7, 2022
2 parents a0b38b7 + 64ceac5 commit 8055c89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mixin/case-xml@1/example/tests/mixin/CaseTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ public function testInstalled($cv) {
$this->assertEquals('Duck Dance Case', $items[0]['title']);
$this->assertEquals(TRUE, $items[0]['is_active']);
$this->assertEquals(1, count($items));

// FIXME: This flush should be unnecessary. The fact that we need it indicates a bug during activation.
// However, the bug is pre-existing, and adding these assertions will ensure that it doesn't get worse.
$cv->api3('System', 'flush', []);

$actTypes = $cv->api4('OptionValue', 'get', [
'where' => [['option_group_id:name', '=', 'activity_type'], ['name', '=', 'Quack']],
]);
$this->assertEquals('Quack', $actTypes[0]['name'], 'ActivityType "Quack" should be auto enabled. It\'s missing.');
$this->assertEquals(TRUE, $actTypes[0]['is_active'], 'ActivityType "Quack" should be auto enabled. It\'s inactive.');
}

public function testDisabled($cv) {
Expand All @@ -37,6 +47,11 @@ public function testDisabled($cv) {
public function testUninstalled($cv) {
$items = $cv->api4('CaseType', 'get', ['where' => [['name', '=', 'DuckDance']]]);
$this->assertEquals(0, count($items));

$actTypes = $cv->api4('OptionValue', 'get', [
'where' => [['option_group_id:name', '=', 'activity_type'], ['name', '=', 'Quack']],
]);
$this->assertEmpty($actTypes);
}

protected static function getPath($suffix = ''): string {
Expand Down
3 changes: 3 additions & 0 deletions mixin/case-xml@1/example/xml/case/DuckDance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<ActivityType>
<name>Phone Call</name>
</ActivityType>
<ActivityType>
<name>Quack</name>
</ActivityType>

</ActivityTypes>

Expand Down

0 comments on commit 8055c89

Please sign in to comment.