Skip to content

Commit

Permalink
Tests: Add fix and refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis531 committed Dec 12, 2024
1 parent de98a58 commit 56004f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 3 additions & 6 deletions tests/VideoCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testIngestVideo(ApiTester $I)
]
]);

$I->assertIsScalar($response->getStatusCode(), 200, 'Video is ingested');
$I->assertEquals($response->getStatusCode(), 200, 'Video is ingested');

// Add video to studip, fails if video is already added
$response = $I->sendPostAsJson('/videos/' . $this->video['identifier'], [
Expand All @@ -80,11 +80,8 @@ public function testIngestVideo(ApiTester $I)
$I->seeVideoIsProcessed($this->video['identifier']);

// Start cronjobs
$success = $I->runCronjob(self::CRONJOB_DISCOVER);
$I->assertTrue($success, 'Cronjob run successful');

$success = $I->runCronjob(self::CRONJOB_QUEUE);
$I->assertTrue($success, 'Cronjob run successful');
$I->runCronjob(self::CRONJOB_DISCOVER);
$I->runCronjob(self::CRONJOB_QUEUE);

$I->seeVideoIsProcessed($this->video['identifier']);
}
Expand Down
5 changes: 2 additions & 3 deletions tests/_support/Helper/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ public function seeVideoIsProcessed($id): bool {
* Run studip cronjob
*
* @param string $cronjob cronjob description
* @return bool success?
*/
public function runCronjob(string $cronjob): bool
public function runCronjob(string $cronjob)
{
$studip_cli = self::STUDIP_DIR . "cli/studip";
exec(
Expand All @@ -71,6 +70,6 @@ public function runCronjob(string $cronjob): bool
$result_code
);

return $result_code === 0;
$this->assertEquals(0, $result_code, 'Cronjob run successful');
}
}

0 comments on commit 56004f3

Please sign in to comment.