Skip to content

Commit

Permalink
Bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed Apr 21, 2024
1 parent e10f490 commit 1f83fd5
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 26 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/backward-compatibility-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ jobs:
name: Backward compatibility check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Roave BC Check
# User in the container seems to be different from the cloned repo's owner.
# Git doesn't like that as the repo will then be unusable by the owner.
# We don't care about this here since this is only used for running one test.
# See https://github.com/actions/runner/issues/2033
- name: Workaround directory permissions
run: mkdir -p /home/runner/work/_temp/_github_home && printf "[safe]\n\tdirectory = /github/workspace" > /home/runner/work/_temp/_github_home/.gitconfig

- name: BC Check
uses: docker://nyholm/roave-bc-check-ga
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.0, 8.1, 8.2]
php: [8.0, 8.1, 8.2, 8.3]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
Expand All @@ -34,7 +34,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ composer.lock

# phpunit
.phpunit.cache
.phpunit.result.cache
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
"homepage": "https://github.com/koot-labs/telegram-bot-dialogs",
"require": {
"php": ">=8.0",
"illuminate/support": "^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0",
"irazasyed/telegram-bot-sdk": "^3.1",
"predis/predis": "^1.0 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5 || ^10.0"
"friendsofphp/php-cs-fixer": "^3.54",
"phpunit/phpunit": "^10.5 || ^11.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down Expand Up @@ -44,6 +45,7 @@
}
},
"scripts": {
"cs": "phpunit",
"test": "phpunit"
}
}
17 changes: 6 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
beStrictAboutCoverageMetadata="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</source>
</phpunit>
6 changes: 4 additions & 2 deletions tests/DialogConfigurableStepsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

use KootLabs\TelegramBotDialogs\Dialog;
use KootLabs\TelegramBotDialogs\Exceptions\InvalidDialogStep;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;

/** @covers \KootLabs\TelegramBotDialogs\Dialog */
#[CoversClass(\KootLabs\TelegramBotDialogs\Dialog::class)]
final class DialogConfigurableStepsTest extends TestCase
{
use CreatesUpdate;

private const RANDOM_CHAT_ID = 42;

/** @test */
#[Test]
public function it_throws_an_exception_when_step_does_not_have_name(): void
{
$dialog = new class (self::RANDOM_CHAT_ID) extends Dialog {
Expand Down
16 changes: 9 additions & 7 deletions tests/DialogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@

use KootLabs\TelegramBotDialogs\Dialog;
use KootLabs\TelegramBotDialogs\Exceptions\InvalidDialogStep;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use function PHPUnit\Framework\assertSame;

/** @covers \KootLabs\TelegramBotDialogs\Dialog */
#[CoversClass(\KootLabs\TelegramBotDialogs\Dialog::class)]
final class DialogTest extends TestCase
{
use CreatesUpdate;

private const RANDOM_CHAT_ID = 42;

/** @test */
#[Test]
public function it_end_after_process_of_a_single_step_dialog(): void
{
$dialog = new class (self::RANDOM_CHAT_ID) extends Dialog {
Expand All @@ -28,7 +30,7 @@ public function existingMethod()
$this->assertTrue($dialog->isEnd());
}

/** @test */
#[Test]
public function it_end_after_process_of_a_multi_step_dialog(): void
{
$dialog = new class (self::RANDOM_CHAT_ID) extends Dialog {
Expand All @@ -47,7 +49,7 @@ public function existingMethodB()
$this->assertTrue($dialog->isEnd());
}

/** @test */
#[Test]
public function it_throws_custom_exception_when_method_not_defined(): void
{
$dialog = new class (self::RANDOM_CHAT_ID) extends Dialog {
Expand All @@ -59,7 +61,7 @@ public function it_throws_custom_exception_when_method_not_defined(): void
$dialog->start($this->buildUpdateOfRandomType());
}

/** @test */
#[Test]
public function it_throws_custom_exception_when_method_not_defined_even_if_magic_call_defined(): void
{
$dialog = new class (self::RANDOM_CHAT_ID) extends Dialog {
Expand All @@ -75,7 +77,7 @@ public function __call(string $method, array $args)
$dialog->start($this->buildUpdateOfRandomType());
}

/** @test */
#[Test]
public function it_can_store_variables_between_steps(): void
{
$dialog = new class (self::RANDOM_CHAT_ID) extends Dialog {
Expand All @@ -96,7 +98,7 @@ public function step2()
$dialog->proceed($this->buildUpdateOfRandomType());
}

/** @test */
#[Test]
public function it_can_rejump_to_the_same_step(): void
{
$dialog = new class (self::RANDOM_CHAT_ID) extends Dialog {
Expand Down

0 comments on commit 1f83fd5

Please sign in to comment.