Skip to content

Commit 2ef246e

Browse files
committed
podpora pro nette 3.1 a php 8.3
1 parent 81aa7ac commit 2ef246e

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

.github/workflows/php-package-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
php: [ 7.4, 8.0 ]
12+
php: [ 7.4, 8.0, 8.1, 8.2, 8.3 ]
1313
steps:
1414
- uses: actions/checkout@v2
1515
- uses: shivammathur/setup-php@v2

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
],
2323
"require": {
2424
"php": "~7.4 | ~8.0",
25-
"nette/application": "^2.4"
25+
"nette/application": "^2.4 | ^3.0"
2626
},
2727
"require-dev": {
2828
"phpstan/phpstan": "^1.0",
2929
"nette/tester": "^2.0",
30-
"mockery/mockery": "^1.0"
30+
"mockery/mockery": "^1.0",
31+
"phpstan/phpstan-nette": "^1.2"
3132
},
3233
"autoload": {
3334
"psr-4": {

phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ parameters:
44
- phpt
55

66
treatPhpDocTypesAsCertain: false
7+
8+
includes:
9+
- vendor/phpstan/phpstan-nette/extension.neon
10+
- vendor/phpstan/phpstan-nette/rules.neon

src/UI/AsyncControlTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ public function handleAsyncLoad(): void
4343
public function renderAsync(string $linkMessage = NULL, array $linkAttributes = NULL): void
4444
{
4545
$template = $this->createTemplate();
46-
if ($template instanceof Template) {
47-
$template->add('link', new AsyncControlLink($linkMessage, $linkAttributes));
48-
}
46+
$template->link = new AsyncControlLink($linkMessage, $linkAttributes);
4947
$template->setFile(__DIR__ . '/templates/asyncLoadLink.latte');
5048
$template->render();
5149
}

tests/UI/AsyncControlTest.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,19 @@ final class AsyncControlTest extends TestCase
6262
{
6363
$control = Mockery::mock(AsyncControl::class)->makePartial();
6464

65-
$template = Mockery::mock(Template::class);
66-
$template->shouldReceive('add')->once()->with('link', Mockery::type(AsyncControlLink::class));
65+
$template = Mockery::mock(Template::class)->makePartial();
66+
$template->link = Mockery::type(AsyncControlLink::class);
6767
$template->shouldReceive('setFile')->once()->withAnyArgs();
6868
$template->shouldReceive('render')->once();
6969

7070
$templateFactory = Mockery::mock(TemplateFactory::class);
71-
$templateFactory->shouldReceive('createTemplate')->once()->with($control)->andReturn($template);
71+
$templateFactory
72+
->shouldReceive('createTemplate')
73+
->once()
74+
->withArgs(
75+
fn ($recievedControl) => $recievedControl === $control
76+
)
77+
->andReturn($template);
7278

7379
$presenter = Mockery::mock(Presenter::class);
7480
$presenter->shouldReceive('getTemplateFactory')->once()->andReturn($templateFactory);

0 commit comments

Comments
 (0)