Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php-package-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 7.4, 8.0 ]
php: [ 7.4, 8.0, 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
],
"require": {
"php": "~7.4 | ~8.0",
"nette/application": "^2.4"
"nette/application": "^2.4 | ^3.0"
},
"require-dev": {
"phpstan/phpstan": "^1.0",
"nette/tester": "^2.0",
"mockery/mockery": "^1.0"
"mockery/mockery": "^1.0",
"phpstan/phpstan-nette": "^1.2"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ parameters:
- phpt

treatPhpDocTypesAsCertain: false

includes:
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/phpstan/phpstan-nette/rules.neon
4 changes: 1 addition & 3 deletions src/UI/AsyncControlTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ public function handleAsyncLoad(): void
public function renderAsync(string $linkMessage = NULL, array $linkAttributes = NULL): void
{
$template = $this->createTemplate();
if ($template instanceof Template) {
$template->add('link', new AsyncControlLink($linkMessage, $linkAttributes));
}
$template->link = new AsyncControlLink($linkMessage, $linkAttributes);
$template->setFile(__DIR__ . '/templates/asyncLoadLink.latte');
$template->render();
}
Expand Down
12 changes: 9 additions & 3 deletions tests/UI/AsyncControlTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ final class AsyncControlTest extends TestCase
{
$control = Mockery::mock(AsyncControl::class)->makePartial();

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

$templateFactory = Mockery::mock(TemplateFactory::class);
$templateFactory->shouldReceive('createTemplate')->once()->with($control)->andReturn($template);
$templateFactory
->shouldReceive('createTemplate')
->once()
->withArgs(
fn ($recievedControl) => $recievedControl === $control
)
->andReturn($template);

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