Skip to content

Commit 9ca5d9c

Browse files
committed
refactor: fix remaining not found methods
1 parent 2cb29b7 commit 9ca5d9c

8 files changed

Lines changed: 21 additions & 44 deletions

File tree

system/Images/Handlers/BaseHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
* Base image handling implementation.
2424
*
2525
* @template T of object
26+
*
27+
* @method string getPathname()
2628
*/
2729
abstract class BaseHandler implements ImageHandlerInterface
2830
{

tests/system/CodeIgniterTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ protected function setUp(): void
6363
$this->codeigniter = new MockCodeIgniter(new App());
6464

6565
$response = service('response');
66+
$this->assertInstanceOf(Response::class, $response);
6667
$response->pretend();
6768
}
6869

@@ -981,10 +982,7 @@ public function testStartControllerPermitsInvoke(): void
981982
$startController = self::getPrivateMethodInvoker($this->codeigniter, 'startController');
982983

983984
$this->setPrivateProperty($this->codeigniter, 'method', '__invoke');
984-
$startController();
985-
986-
// No PageNotFoundException
987-
$this->expectNotToPerformAssertions();
985+
$this->assertNull($startController());
988986
}
989987

990988
public function testRouteAttributeCacheIntegration(): void

tests/system/Images/GDHandlerTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,12 @@ public function testImageCopy(): void
346346
$this->handler->save($this->start . 'work/ci-logo.' . $type);
347347
$this->assertTrue($this->root->hasChild('work/ci-logo.' . $type));
348348

349+
/** @var vfsStreamFile $child */
350+
$child = $this->root->getChild('work/ci-logo.' . $type);
351+
349352
$this->assertNotSame(
350353
file_get_contents($this->origin . 'ci-logo.' . $type),
351-
$this->root->getChild('work/ci-logo.' . $type)->getContent(),
354+
$child->getContent(),
352355
);
353356
}
354357
}
@@ -380,9 +383,12 @@ public function testImageCompressionGetResource(): void
380383
$this->handler->save($this->start . 'work/ci-logo.' . $type);
381384
$this->assertTrue($this->root->hasChild('work/ci-logo.' . $type));
382385

386+
/** @var vfsStreamFile $child */
387+
$child = $this->root->getChild('work/ci-logo.' . $type);
388+
383389
$this->assertNotSame(
384390
file_get_contents($this->origin . 'ci-logo.' . $type),
385-
$this->root->getChild('work/ci-logo.' . $type)->getContent(),
391+
$child->getContent(),
386392
);
387393
}
388394
}
@@ -401,9 +407,12 @@ public function testImageCompressionWithResource(): void
401407

402408
$this->assertTrue($this->root->hasChild('work/ci-logo.' . $type));
403409

410+
/** @var vfsStreamFile $child */
411+
$child = $this->root->getChild('work/ci-logo.' . $type);
412+
404413
$this->assertNotSame(
405414
file_get_contents($this->origin . 'ci-logo.' . $type),
406-
$this->root->getChild('work/ci-logo.' . $type)->getContent(),
415+
$child->getContent(),
407416
);
408417
}
409418
}

tests/system/Models/FindModelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function testFindClearsBinds(): void
133133
$binds = $this->model->builder()->getBinds();
134134
$this->assertCount(0, $binds);
135135

136-
$query = $this->model->getLastQuery();
136+
$query = $this->model->db->getLastQuery();
137137
$this->assertCount(1, $this->getPrivateProperty($query, 'binds'));
138138
}
139139

tests/system/Models/GeneralModelTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public function testUndefinedModelMethod(): void
8383
{
8484
$this->expectException(BadMethodCallException::class);
8585
$this->expectExceptionMessage('Call to undefined method Tests\Support\Models\UserModel::undefinedMethodCall');
86-
$this->createModel(UserModel::class)->undefinedMethodCall();
86+
87+
$this->createModel(UserModel::class)->undefinedMethodCall(); // @phpstan-ignore method.notFound (Testing Model::__call() fallback)
8788
}
8889

8990
public function testSetAllowedFields(): void

tests/system/RESTful/ResourceControllerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ private function createCodeigniter(): void
8080
$this->codeigniter = new MockCodeIgniter($config);
8181

8282
$response = service('response');
83+
$this->assertInstanceOf(Response::class, $response);
8384
$response->pretend();
8485
}
8586

utils/phpstan-baseline/loader.neon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 153 errors
1+
# total 145 errors
22

33
includes:
44
- argument.type.neon
@@ -8,7 +8,6 @@ includes:
88
- function.resultUnused.neon
99
- method.childParameterType.neon
1010
- method.childReturnType.neon
11-
- method.notFound.neon
1211
- missingType.iterableValue.neon
1312
- missingType.parameter.neon
1413
- property.defaultValue.neon

utils/phpstan-baseline/method.notFound.neon

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

0 commit comments

Comments
 (0)