diff --git a/tests/BotTest.php b/tests/BotTest.php index d95f5052b4721334895f75b15e65b25056bc873b..a46683f8a89123dbc14cf459ed0bbb40756db226 100644 --- a/tests/BotTest.php +++ b/tests/BotTest.php @@ -6,8 +6,8 @@ use CSlant\TelegramGitNotifier\Models\Setting; it('can be instantiated with default parameters', function () { $bot = new Bot( - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); expect($bot)->toBeInstanceOf(Bot::class) @@ -19,8 +19,8 @@ it('can be instantiated with custom event', function () { $event = new Event(); $bot = new Bot( event: $event, - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); expect($bot->event)->toBe($event); @@ -29,8 +29,8 @@ it('can be instantiated with custom event', function () { it('can be instantiated with custom platform', function () { $bot = new Bot( platform: 'github', - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); expect($bot->event->platform)->toBe('github'); @@ -40,8 +40,8 @@ it('can be instantiated with custom setting', function () { $setting = new Setting(); $bot = new Bot( setting: $setting, - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); expect($bot->setting)->toBe($setting); @@ -49,8 +49,8 @@ it('can be instantiated with custom setting', function () { it('sets default platform when not specified', function () { $bot = new Bot( - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); expect($bot->event->platform)->toBe('github'); @@ -60,8 +60,8 @@ it('validates platform file on construction', function () { // This should not throw if the platform file exists $bot = new Bot( platform: 'github', - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); expect($bot->event->getEventConfig())->toBeArray(); @@ -69,8 +69,8 @@ it('validates platform file on construction', function () { it('validates setting file on construction', function () { $bot = new Bot( - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); expect($bot->setting->getSettingFile())->not->toBeEmpty(); diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index aceb7a3d7b72e987ffea661e7651ab6be113e375..6a4072d0d0ba080b80055353ce98af3084090e0b 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -4,8 +4,8 @@ use CSlant\TelegramGitNotifier\Bot; beforeEach(function () { $this->bot = new Bot( - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); }); @@ -14,7 +14,7 @@ it('should return true', function () { }); it('platform can be set for event with platform parameter', function () { - $this->bot->setPlatFormForEvent('gitlab', __DIR__.'/../config/jsons/gitlab-events.json'); + $this->bot->setPlatFormForEvent('gitlab', __DIR__ . '/../config/jsons/gitlab-events.json'); expect($this->bot->event->platform)->toBe('gitlab'); }); @@ -24,33 +24,33 @@ it('platform can be set for event with null parameter', function () { }); it('platform can be set for event with platform file', function () { - $this->bot->setPlatFormForEvent('gitlab', __DIR__.'/../config/jsons/gitlab-events.json'); + $this->bot->setPlatFormForEvent('gitlab', __DIR__ . '/../config/jsons/gitlab-events.json'); expect($this->bot->event->platform)->toBe('gitlab') ->and($this->bot->event->platformFile) - ->toBe(__DIR__.'/../config/jsons/gitlab-events.json'); + ->toBe(__DIR__ . '/../config/jsons/gitlab-events.json'); }); it('can get json config for event - github', function () { - $this->bot->setPlatFormForEvent('github', __DIR__.'/../config/jsons/github-events.json'); + $this->bot->setPlatFormForEvent('github', __DIR__ . '/../config/jsons/github-events.json'); expect($this->bot->event->getEventConfig())->toBeArray() ->and($this->bot->event->getEventConfig())->toHaveKey('issue_comment'); }); it('can get json config for event - gitlab', function () { - $this->bot->setPlatFormForEvent('gitlab', __DIR__.'/../config/jsons/gitlab-events.json'); + $this->bot->setPlatFormForEvent('gitlab', __DIR__ . '/../config/jsons/gitlab-events.json'); expect($this->bot->event->getEventConfig())->toBeArray() ->and($this->bot->event->getEventConfig())->toHaveKey('tag_push'); }); it('setting file is valid', function () { - $this->bot->updateSetting(__DIR__.'/../config/jsons/tgn-settings.json'); + $this->bot->updateSetting(__DIR__ . '/../config/jsons/tgn-settings.json'); $this->bot->validateSettingFile(); expect($this->bot->setting->getSettings())->toBeArray(); }); it('platform file is valid', function () { - $this->bot->setPlatFormForEvent('github', __DIR__.'/../config/jsons/github-events.json'); + $this->bot->setPlatFormForEvent('github', __DIR__ . '/../config/jsons/github-events.json'); $this->bot->validatePlatformFile(); expect($this->bot->event->getEventConfig())->toBeArray(); diff --git a/tests/NotifierTest.php b/tests/NotifierTest.php index 30c5f19c87d812a5b76c5edc763540392bffa78a..217d38b27a36476ebc136038d87080834c64e14b 100644 --- a/tests/NotifierTest.php +++ b/tests/NotifierTest.php @@ -3,15 +3,15 @@ use CSlant\TelegramGitNotifier\Notifier; beforeEach(function () { - $this->notifier = new Notifier(platformFile: __DIR__.'/../config/jsons/github-events.json'); + $this->notifier = new Notifier(platformFile: __DIR__ . '/../config/jsons/github-events.json'); }); it('validates that the event files exist', function () { - $this->notifier->setPlatFormForEvent('gitlab', __DIR__.'/../config/jsons/gitlab-events.json'); + $this->notifier->setPlatFormForEvent('gitlab', __DIR__ . '/../config/jsons/gitlab-events.json'); expect($this->notifier->event->getEventConfig())->toBeArray() ->and($this->notifier->event->getEventConfig())->toHaveKey('tag_push'); - $this->notifier->setPlatFormForEvent('github', __DIR__.'/../config/jsons/github-events.json'); + $this->notifier->setPlatFormForEvent('github', __DIR__ . '/../config/jsons/github-events.json'); expect($this->notifier->event->getEventConfig())->toBeArray() ->and($this->notifier->event->getEventConfig()) ->toHaveKey('issue_comment'); diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index 8fb97b4bca72d9b445840ccbdbaa31933969619e..ec92ddc4ecb88cdbeba5a88817e0bd553d73f9e9 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -5,8 +5,8 @@ use CSlant\TelegramGitNotifier\Objects\Validator; beforeEach(function () { $this->bot = new Bot( - platformFile: __DIR__.'/../config/jsons/github-events.json', - settingFile: __DIR__.'/../config/jsons/tgn-settings.json' + platformFile: __DIR__ . '/../config/jsons/github-events.json', + settingFile: __DIR__ . '/../config/jsons/tgn-settings.json' ); $this->validator = new Validator($this->bot->setting, $this->bot->event); }); @@ -29,13 +29,13 @@ it('can\'t validate the event that has an action but no payload to send a notifi }); it('can validate the event that has no action to send a notification - gitlab', function () { - $this->bot->setPlatFormForEvent('gitlab', __DIR__.'/../config/jsons/gitlab-events.json'); + $this->bot->setPlatFormForEvent('gitlab', __DIR__ . '/../config/jsons/gitlab-events.json'); $result = $this->validator->isAccessEvent('gitlab', 'push', (object)[]); expect($result)->toBeTrue(); }); it('can validate the event that has an action to send a notification - gitlab', function () { - $this->bot->setPlatFormForEvent('gitlab', __DIR__.'/../config/jsons/gitlab-events.json'); + $this->bot->setPlatFormForEvent('gitlab', __DIR__ . '/../config/jsons/gitlab-events.json'); $result = $this->validator->isAccessEvent('gitlab', 'merge_request', (object)[ 'action' => 'open', ]); @@ -43,7 +43,7 @@ it('can validate the event that has an action to send a notification - gitlab', }); it('can\'t validate the event that has an action but no payload to send a notification - gitlab', function () { - $this->bot->setPlatFormForEvent('gitlab', __DIR__.'/../config/jsons/gitlab-events.json'); + $this->bot->setPlatFormForEvent('gitlab', __DIR__ . '/../config/jsons/gitlab-events.json'); $result = $this->validator->isAccessEvent('gitlab', 'merge_request', (object)[]); expect($result)->toBeFalse(); });