Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(NFC) case-xml@1 - Add example+assertions of new activity-type #23959

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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