CaiWuXiTong/tests/Unit/Deployment/PromotionExpenseScheduleTest.php

31 lines
1.3 KiB
PHP

<?php
namespace Tests\Unit\Deployment;
use PHPUnit\Framework\TestCase;
class PromotionExpenseScheduleTest extends TestCase
{
public function test_release_and_batch_scripts_schedule_promotion_expense_sync(): void
{
$root = dirname(__DIR__, 3);
$schedules = [
'10 3 * * * root /usr/bin/timeout 1800 /bin/sh /opt/caiwuxitong/run-finance-batch.sh business-mirror:sync-promotion-expenses --days=7 --quiet',
'20 3 * * * root /usr/bin/timeout 1800 /bin/sh /opt/caiwuxitong/run-finance-batch.sh business-mirror:sync-jushuitan-shop-promotion-fees --days=7 --quiet',
];
foreach (['deploy/activate-release.sh', 'deploy/activate-incremental-release.sh'] as $file) {
$contents = file_get_contents($root . '/' . $file);
$this->assertIsString($contents);
foreach ($schedules as $schedule) {
$this->assertStringContainsString($schedule, $contents, $file);
}
}
$runner = file_get_contents($root . '/deploy/run-finance-batch.sh');
$this->assertIsString($runner);
$this->assertStringContainsString('business-mirror:sync-promotion-expenses', $runner);
$this->assertStringContainsString('business-mirror:sync-jushuitan-shop-promotion-fees', $runner);
}
}