Skip to content

Commit

Permalink
check for the UndefinedInterfaceMethod psalm
Browse files Browse the repository at this point in the history
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
  • Loading branch information
nabim777 committed Sep 23, 2024
1 parent 034a2c4 commit 46bdc06
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
<directory name="tests" />
<ignoreFiles>
<directory name="vendor" />
<directory name="../../**" />
<directory name="../**" />
<directory name="../../lib" />
</ignoreFiles>
</projectFiles>
<stubs>
Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,10 @@ public function getIdOfFileOrFolder(string $user, string $path): int {
'oc',
'http://owncloud.org/ns'
);
return (int)(string)$responseXmlObject->xpath('//oc:fileid')[0];
$fileId = $responseXmlObject->xpath('//oc:fileid')[0];
Assert::assertNotNull($fileId, __METHOD__ . " file $path user $user not found (the file may not exist)");

return (int)(string) $fileId;
}

public function fileOrFolderExists(string $user, string $path): bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function theVersionFolderOfFileShouldContainElements(
int $count
):void {
$fileId = $this->featureContext->getIdOfFileOrFolder($user, $path);
Assert::assertNotNull($fileId, __METHOD__ . " file $path user $user not found (the file may not exist)");
$this->theVersionFolderOfFileIdShouldContainElements($user, $fileId, $count);
}

Expand Down
9 changes: 5 additions & 4 deletions tests/lib/Controller/OpenProjectAPIControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
use Psr\Log\LoggerInterface;

class OpenProjectAPIControllerTest extends TestCase {
/** @var IConfig $configMock */
/** @var IConfig */
private $configMock;

/** @var IRequest $requestMock */
/** @var IRequest */
private $requestMock;

/**
Expand Down Expand Up @@ -79,9 +79,10 @@ public function setUpMocks(): void {

/**
* @param string $token
* @psalm-suppress UndefinedInterfaceMethod
* @return void
*/
public function getUserValueMock($token = '123') {
public function getUserValueMock(string $token = '123'): void {
$this->configMock
->method('getUserValue')
->withConsecutive(
Expand All @@ -93,7 +94,7 @@ public function getUserValueMock($token = '123') {
/**
* @return void
*/
public function testGetNotifications() {
public function testGetNotifications(): void {
$this->getUserValueMock();
$service = $this->getMockBuilder(OpenProjectAPIService::class)
->disableOriginalConstructor()
Expand Down
1 change: 0 additions & 1 deletion tests/lib/Service/OpenProjectAPIServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ private function getOpenProjectAPIService(
) {
$certificateManager = $this->getMockBuilder('\OCP\ICertificateManager')->getMock();
$certificateManager->method('getAbsoluteBundlePath')->willReturn('/');
$ocClient = null;
$client = new GuzzleClient();
$clientConfigMock = $this->getMockBuilder(IConfig::class)->getMock();
$clientConfigMock
Expand Down

0 comments on commit 46bdc06

Please sign in to comment.