Skip to content

Commit

Permalink
Merge pull request #237 from humhub/fix/test-v1.15
Browse files Browse the repository at this point in the history
[1.15] Update tests to v1.15
  • Loading branch information
luke- authored Dec 7, 2023
2 parents 5c35e5d + da48863 commit 1dbc55d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 45 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/php-test-master.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: PHP Codeception Tests - master

on:
push:

jobs:
tests:
uses: humhub/actions/.github/workflows/module-tests-master.yml@main
with:
module-id: tasks
use-rest-module: true
name: PHP Codeception Tests - master

on:
push:
schedule:
- cron: "0 0 * * 0"

jobs:
tests:
uses: humhub/actions/.github/workflows/module-tests-master.yml@main
with:
module-id: tasks
use-rest-module: true
13 changes: 13 additions & 0 deletions .github/workflows/php-test-v1.14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: PHP Codeception Tests - v1.14

on:
push:
schedule:
- cron: "0 0 * * 0"

jobs:
tests:
uses: humhub/actions/.github/workflows/module-tests-v1.14.yml@main
with:
module-id: tasks
use-rest-module: true
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.8.3 (Unreleased)
-------------------
- Fix #237: Update tests for compatibility with v1.15

1.8.2 (Unreleased)
-------------------
- Fix #232: Set All Icons color to @text-color-main (#555)
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Tasks",
"description": "Intuitive task management tool with many basic and advanced features.",
"keywords": ["task", "todo"],
"version": "1.8.2",
"version": "1.8.3",
"homepage": "https://github.com/humhub/tasks",
"humhub": {
"minVersion": "1.14"
Expand Down
34 changes: 1 addition & 33 deletions tests/codeception/_support/TaskTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

use humhub\modules\content\components\ContentContainerActiveRecord;
use humhub\modules\content\models\Content;
use humhub\modules\notification\models\Notification;
use humhub\modules\tasks\models\Task;
use humhub\modules\tasks\models\lists\TaskList;
use tests\codeception\_support\HumHubDbTestCase;
use yii\db\ActiveRecord;

class TaskTestCase extends HumHubDbTestCase
{
Expand Down Expand Up @@ -38,34 +36,4 @@ public function createTask(ContentContainerActiveRecord $contentContainer, $titl
$task->refresh();
return $task;
}

public function assertHasNoNotification($class, ActiveRecord $source, $originator_id = null, $target_id = null, $msg = '')
{
$notificationQuery = Notification::find()->where(['class' => $class, 'source_class' => $source->className(), 'source_pk' => $source->getPrimaryKey()]);

if ($originator_id != null) {
$notificationQuery->andWhere(['originator_user_id' => $originator_id]);
}

if($target_id != null) {
$notificationQuery->andWhere(['user_id' => $target_id]);
}

$this->assertEmpty($notificationQuery->all(), $msg);
}

public function assertEqualsNotificationCount($count, $class, ActiveRecord $source, $originator_id = null, $target_id = null, $msg = '')
{
$notificationQuery = Notification::find()->where(['class' => $class, 'source_class' => $source->className(), 'source_pk' => $source->getPrimaryKey()]);

if ($originator_id != null) {
$notificationQuery->andWhere(['originator_user_id' => $originator_id]);
}

if($target_id != null) {
$notificationQuery->andWhere(['user_id' => $target_id]);
}

$this->assertEquals($count, $notificationQuery->count(), $msg);
}
}
}

0 comments on commit 1dbc55d

Please sign in to comment.