diff options
| author | 2023-05-11 12:53:32 +0200 | |
|---|---|---|
| committer | 2023-05-11 12:53:32 +0200 | |
| commit | fe7d9bbcd68660a59b813346c236b61b25a51c80 (patch) | |
| tree | 95be837c2838659a3ea72974c9f9b18b1ee634ca /tests | |
| parent | 2343f0ded14ac6970575c23e4de34e536241b623 (diff) | |
Typed view model classes (#5380)
* Typed view model classes
* Add ability to provide a typed view model class to a controller
* Use `::class` instead of string for referring to classes
* Examplified with `stats` and `javascript` controllers / views (more to do)
* Also useful for extensions (my usecase today), which did not have the ability to define own view model attributes before.
* Typo
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/app/Models/UserQueryTest.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/app/Models/UserQueryTest.php b/tests/app/Models/UserQueryTest.php index d8610a81b..c227024a9 100644 --- a/tests/app/Models/UserQueryTest.php +++ b/tests/app/Models/UserQueryTest.php @@ -30,13 +30,13 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function test__construct_whenCategoryQuery_storesCategoryParameters(): void { $category_name = 'some category name'; /** @var FreshRSS_Category&PHPUnit\Framework\MockObject\MockObject */ - $cat = $this->createMock('FreshRSS_Category'); + $cat = $this->createMock(FreshRSS_Category::class); $cat->expects($this->atLeastOnce()) ->method('name') ->withAnyParameters() ->willReturn($category_name); /** @var FreshRSS_CategoryDAO&PHPUnit\Framework\MockObject\MockObject */ - $cat_dao = $this->createMock('FreshRSS_CategoryDAO'); + $cat_dao = $this->createMock(FreshRSS_CategoryDAO::class); $cat_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -58,13 +58,13 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function test__construct_whenFeedQuery_storesFeedParameters(): void { $feed_name = 'some feed name'; /** @var FreshRSS_Feed&PHPUnit\Framework\MockObject\MockObject */ - $feed = $this->createMock('FreshRSS_Feed'); + $feed = $this->createMock(FreshRSS_Feed::class); $feed->expects($this->atLeastOnce()) ->method('name') ->withAnyParameters() ->willReturn($feed_name); /** @var FreshRSS_FeedDAO&PHPUnit\Framework\MockObject\MockObject */ - $feed_dao = $this->createMock('FreshRSS_FeedDAO'); + $feed_dao = $this->createMock(FreshRSS_FeedDAO::class); $feed_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -164,9 +164,9 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function testIsDeprecated_whenCategoryExists_returnFalse(): void { /** @var FreshRSS_Category&PHPUnit\Framework\MockObject\MockObject */ - $cat = $this->createMock('FreshRSS_Category'); + $cat = $this->createMock(FreshRSS_Category::class); /** @var FreshRSS_CategoryDAO&PHPUnit\Framework\MockObject\MockObject */ - $cat_dao = $this->createMock('FreshRSS_CategoryDAO'); + $cat_dao = $this->createMock(FreshRSS_CategoryDAO::class); $cat_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -178,7 +178,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function testIsDeprecated_whenCategoryDoesNotExist_returnTrue(): void { /** @var FreshRSS_CategoryDAO&PHPUnit\Framework\MockObject\MockObject */ - $cat_dao = $this->createMock('FreshRSS_CategoryDAO'); + $cat_dao = $this->createMock(FreshRSS_CategoryDAO::class); $cat_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -190,9 +190,9 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function testIsDeprecated_whenFeedExists_returnFalse(): void { /** @var FreshRSS_Feed&PHPUnit\Framework\MockObject\MockObject */ - $feed = $this->createMock('FreshRSS_Feed'); + $feed = $this->createMock(FreshRSS_Feed::class); /** @var FreshRSS_FeedDAO&PHPUnit\Framework\MockObject\MockObject */ - $feed_dao = $this->createMock('FreshRSS_FeedDAO'); + $feed_dao = $this->createMock(FreshRSS_FeedDAO::class); $feed_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -204,7 +204,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function testIsDeprecated_whenFeedDoesNotExist_returnTrue(): void { /** @var FreshRSS_FeedDAO&PHPUnit\Framework\MockObject\MockObject */ - $feed_dao = $this->createMock('FreshRSS_FeedDAO'); + $feed_dao = $this->createMock(FreshRSS_FeedDAO::class); $feed_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() |
