Skip to content

Commit c10ba0e

Browse files
committed
patch(tests): falling test
1 parent ebbbdbb commit c10ba0e

File tree

5 files changed

+32
-43
lines changed

5 files changed

+32
-43
lines changed

composer.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@
1717
],
1818
"require": {
1919
"php": "^8.2",
20-
"illuminate/contracts": "^11.0||^12.0",
20+
"illuminate/contracts": "^10.0||^11.0||^12.0",
2121
"laravel/slack-notification-channel": "^3.5",
2222
"spatie/laravel-package-tools": "^1.16"
2323
},
2424
"require-dev": {
25+
"phpunit/phpunit" : "^11.0.1",
2526
"laravel/pint": "^1.14",
2627
"nunomaduro/collision": "^8.1.1||^7.10.0",
2728
"larastan/larastan": "^2.9||^3.0",
28-
"orchestra/testbench": "^10.0.0||^9.0.0||^8.22.0",
29-
"pestphp/pest": "^3.0",
30-
"pestphp/pest-plugin-arch": "^3.0",
31-
"pestphp/pest-plugin-laravel": "^3.0",
3229
"phpstan/extension-installer": "^1.3||^2.0",
3330
"phpstan/phpstan-deprecation-rules": "^1.1||^2.0",
3431
"phpstan/phpstan-phpunit": "^1.3||^2.0",
@@ -56,8 +53,7 @@
5653
],
5754
"prepare": "@php vendor/bin/testbench package:discover --ansi",
5855
"analyse": "vendor/bin/phpstan analyse",
59-
"test": "vendor/bin/pest",
60-
"test-coverage": "vendor/bin/pest --coverage",
56+
"test": "@php vendor/bin/phpunit --testsuite=Feature",
6157
"format": "vendor/bin/pint",
6258
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
6359
"build": "@php vendor/bin/testbench workbench:build --ansi",
@@ -74,7 +70,6 @@
7470
"config": {
7571
"sort-packages": true,
7672
"allow-plugins": {
77-
"pestphp/pest-plugin": true,
7873
"phpstan/extension-installer": true
7974
}
8075
},
@@ -87,4 +82,4 @@
8782
},
8883
"minimum-stability": "dev",
8984
"prefer-stable": true
90-
}
85+
}

tests/ArchTest.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/ExampleTest.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/LoggingTest.php

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
<?php
22

3+
namespace Kevariable\SlackLogging\Tests;
4+
5+
use Exception;
36
use Illuminate\Support\Facades\Log;
47
use Kevariable\SlackLogging\Facades\SlackLogging;
8+
use PHPUnit\Framework\Attributes\Test;
59

6-
use function Pest\Laravel\get;
10+
class LoggingTest extends TestCase
11+
{
12+
protected function setUp(): void
13+
{
14+
parent::setUp();
715

8-
beforeEach(function () {
9-
SlackLogging::fake();
16+
SlackLogging::fake();
1017

11-
config()->set('logging.channels.slack.driver', 'slack-logging');
12-
config()->set('logging.channels.stack.channels', ['single', 'slack']);
13-
config()->set('slack-logging.environments', ['testing']);
14-
});
18+
config()->set('logging.channels.slack.driver', 'slack-logging');
19+
config()->set('logging.channels.stack.channels', ['single', 'slack']);
20+
config()->set('slack-logging.environments', ['testing']);
21+
}
1522

16-
it(description: 'will not send log information to slack')
17-
->defer(function (): void {
18-
app()['router']->get('/log-information-via-route/{type}', function (string $type) {
23+
#[Test]
24+
public function it_will_not_send_log_information_to_slack()
25+
{
26+
$this->app['router']->get('/log-information-via-route/{type}', function (string $type) {
1927
Log::{$type}('log');
2028
});
2129

@@ -28,16 +36,18 @@
2836
$this->get('/log-information-via-route/alert');
2937
$this->get('/log-information-via-route/emergency');
3038

31-
SlackLogging::assertRequestsSent(expectedCount: 0);
32-
});
39+
SlackLogging::assertRequestsSent(0);
40+
}
3341

34-
it(description: 'will send log information to slack')
35-
->defer(function (): void {
36-
app()['router']->get('/throwables-via-route', function () {
42+
#[Test]
43+
public function it_will_send_log_information_to_slack()
44+
{
45+
$this->app['router']->get('/throwables-via-route', function () {
3746
throw new Exception('Sent to Slack Logging.');
3847
});
3948

40-
get('/throwables-via-route');
49+
$this->get('/throwables-via-route');
4150

42-
SlackLogging::assertRequestsSent(expectedCount: 1);
43-
});
51+
SlackLogging::assertRequestsSent(1);
52+
}
53+
}

tests/Pest.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)