simedkom/tests/Unit/Enums/ChannelTest.php
2026-03-17 21:57:24 +07:00

38 lines
1.1 KiB
PHP

<?php
use App\Enums\Channel;
test('channel enum has expected cases', function () {
expect(Channel::cases())->toHaveCount(7);
});
test('channel enum labels and colors', function (Channel $channel, string $label, string $color) {
expect($channel->getLabel())->toBe($label);
expect($channel->getColor())->toBe($color);
})->with([
[Channel::WEBSITE, 'Website', 'info'],
[Channel::TIKTOK, 'Tiktok', 'success'],
[Channel::YOUTUBE, 'Youtube', 'warning'],
[Channel::FACEBOOK, 'Facebook', 'danger'],
[Channel::INSTAGRAM, 'Instagram', 'primary'],
[Channel::TWITTER, 'Twitter', 'secondary'],
[Channel::OTHER, 'Other', 'gray'],
]);
test('channel enum options', function () {
expect(Channel::options())->toEqual([
1 => 'Website',
2 => 'Tiktok',
3 => 'Youtube',
4 => 'Facebook',
5 => 'Instagram',
6 => 'Twitter',
7 => 'Other',
]);
});
test('channel enum values and comment', function () {
expect(Channel::values())->toEqual([1, 2, 3, 4, 5, 6, 7]);
expect(Channel::comment())->toBe('1: Website, 2: Tiktok, 3: Youtube, 4: Facebook, 5: Instagram, 6: Twitter, 7: Other');
});