Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Jan 10, 2025
1 parent 6e6660e commit 33823d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: run-tests
on:
push:
paths:
- '**.php'
- '.github/workflows/run-tests.yml'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
- "**.php"
- ".github/workflows/run-tests.yml"
- "phpunit.xml.dist"
- "composer.json"
- "composer.lock"

jobs:
test:
Expand All @@ -23,7 +23,8 @@ jobs:
include:
- laravel: 11.*
testbench: 9.*
carbon: ^2.63
- laravel: 10.*
testbench: 8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand All @@ -45,7 +46,7 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.os == 'windows-latest' && '^^^' || '' }}${{ matrix.carbon }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
Expand Down
18 changes: 9 additions & 9 deletions tests/GithubIssueHandlerFactoryTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

use Monolog\Level;
use Monolog\Logger;
use Naoray\LaravelGithubMonolog\GithubIssueFormatter;
use Naoray\LaravelGithubMonolog\GithubIssueHandlerFactory;
use Naoray\LaravelGithubMonolog\GithubIssueLoggerHandler;

test('it creates handler with correct configuration', function () {
test('it creates logger with correct configuration', function () {
$config = [
'repo' => 'test/repo',
'token' => 'fake-token',
Expand All @@ -16,21 +17,20 @@
$factory = new GithubIssueHandlerFactory;
$handler = $factory($config);

expect($handler)
->toBeInstanceOf(GithubIssueLoggerHandler::class)
->and($handler->getFormatter())
->toBeInstanceOf(GithubIssueFormatter::class)
->and($handler->getLevel())
->toBe(Level::Error);
expect($logger)
->toBeInstanceOf(Logger::class)
->and($logger->getName())->toBe('github')
->and($logger->getHandlers()[0])
->toBeInstanceOf(GithubIssueLoggerHandler::class);
});

test('it throws exception for missing required config', function () {
$factory = new GithubIssueHandlerFactory;

expect(fn () => $factory([]))
expect(fn() => $factory([]))
->toThrow(InvalidArgumentException::class, 'GitHub repository is required');

expect(fn () => $factory(['repo' => 'test/repo']))
expect(fn() => $factory(['repo' => 'test/repo']))
->toThrow(InvalidArgumentException::class, 'GitHub token is required');
});

Expand Down

0 comments on commit 33823d7

Please sign in to comment.