Skip to content

Commit

Permalink
PHPStan for tests folder
Browse files Browse the repository at this point in the history
  • Loading branch information
radimvaculik committed May 4, 2024
1 parent 92e4434 commit ee93748
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"nextras/dbal": "^4.0",
"nextras/orm": "^4.0",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-nette": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.4",
"tharos/leanmapper": "^3.4.2 || ^4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ includes:
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/phpstan/phpstan-nette/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-mockery/extension.neon

parameters:
level: 8

paths:
- src
- tests

checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
Expand Down
1 change: 1 addition & 0 deletions tests/Files/TestPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ protected function createComponentGrid(): TestGridControl

protected function createTemplate(?string $class = null): Template
{
// @phpstan-ignore-next-line
return Mockery::mock(Template::class)
->shouldReceive('getFile')
->andReturn(__DIR__ . '/template.latte')
Expand Down
2 changes: 2 additions & 0 deletions tests/Files/TestingDatagridFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Contributte\Datagrid\Datagrid;
use Nette\Application\PresenterFactory;
use Nette\Application\UI\Presenter;
use Nette\Http\Request;
use Nette\Http\Response;
use Nette\Http\Session;
Expand All @@ -17,6 +18,7 @@ public function createTestingDatagrid(string $presenterName = 'Testing'): Datagr
$presenterFactory = new PresenterFactory();
$presenterFactory->setMapping(['*' => 'Contributte\Datagrid\Tests\Files\*Presenter']);

/** @var Presenter $presenter */
$presenter = $presenterFactory->createPresenter($presenterName);

$url = new UrlScript('http://localhost');
Expand Down
2 changes: 2 additions & 0 deletions tests/Files/TestingDatagridFactoryRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Nette\Application\PresenterFactory;
use Nette\Application\Request;
use Nette\Application\Routers\SimpleRouter;
use Nette\Application\UI\Presenter;
use Nette\ComponentModel\IComponent;
use Nette\Http\Request as HttpRequest;
use Nette\Http\Response;
Expand All @@ -19,6 +20,7 @@ public function createTestingDatagrid(): ?IComponent
$presenterFactory = new PresenterFactory();
$presenterFactory->setMapping(['*' => 'Contributte\Datagrid\Tests\Files\*Presenter']);

/** @var Presenter $presenter */
$presenter = $presenterFactory->createPresenter('Test');

$url = new UrlScript('http://localhost/index.php');
Expand Down

0 comments on commit ee93748

Please sign in to comment.