Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed Sep 16, 2024
1 parent 0012602 commit 9f70325
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 29 deletions.
20 changes: 10 additions & 10 deletions tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public function testGetContactsWithoutFilter(): void {
->with($this->equalTo(''), $this->equalTo(['FN', 'EMAIL']))
->willReturn([
[
'UID' => 123,
'UID' => '123',
],
[
'UID' => 567,
'UID' => '567',
'FN' => 'Darren Roner',
'EMAIL' => [
'darren@roner.au'
Expand Down Expand Up @@ -110,7 +110,7 @@ public function testGetContactsHidesOwnEntry(): void {
'UID' => 'user123',
],
[
'UID' => 567,
'UID' => '567',
'FN' => 'Darren Roner',
'EMAIL' => [
'darren@roner.au'
Expand Down Expand Up @@ -138,10 +138,10 @@ public function testGetContactsWithoutBinaryImage(): void {
->with($this->equalTo(''), $this->equalTo(['FN', 'EMAIL']))
->willReturn([
[
'UID' => 123,
'UID' => '123',
],
[
'UID' => 567,
'UID' => '567',
'FN' => 'Darren Roner',
'EMAIL' => [
'darren@roner.au'
Expand All @@ -167,10 +167,10 @@ public function testGetContactsWithoutAvatarURI(): void {
->with($this->equalTo(''), $this->equalTo(['FN', 'EMAIL']))
->willReturn([
[
'UID' => 123,
'UID' => '123',
],
[
'UID' => 567,
'UID' => '567',
'FN' => 'Darren Roner',
'EMAIL' => [
'darren@roner.au'
Expand Down Expand Up @@ -868,7 +868,7 @@ public function testFindOneUser(): void {
->with($this->equalTo('a567'), $this->equalTo(['UID']))
->willReturn([
[
'UID' => 123,
'UID' => '123',
'isLocalSystemBook' => false
],
[
Expand Down Expand Up @@ -899,7 +899,7 @@ public function testFindOneEMail(): void {
->with($this->equalTo('darren@roner.au'), $this->equalTo(['EMAIL']))
->willReturn([
[
'UID' => 123,
'UID' => '123',
'isLocalSystemBook' => false
],
[
Expand Down Expand Up @@ -939,7 +939,7 @@ public function testFindOneNoMatches(): void {
->with($this->equalTo('a567'), $this->equalTo(['UID']))
->willReturn([
[
'UID' => 123,
'UID' => '123',
'isLocalSystemBook' => false
],
[
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/Files/Mount/MountPointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testGetStorage(): void {
$storage = $this->createMock(Storage::class);
$storage->expects($this->once())
->method('getId')
->willReturn(123);
->willReturn('123');

$loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
Expand All @@ -34,7 +34,7 @@ public function testGetStorage(): void {
);

$this->assertEquals($storage, $mountPoint->getStorage());
$this->assertEquals(123, $mountPoint->getStorageId());
$this->assertEquals('123', $mountPoint->getStorageId());
$this->assertEquals('/mountpoint/', $mountPoint->getMountPoint());

$mountPoint->setMountPoint('another');
Expand Down
6 changes: 4 additions & 2 deletions tests/lib/Files/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,8 @@ public function basicOperationProviderForLocks() {
ILockingProvider::LOCK_SHARED,
ILockingProvider::LOCK_EXCLUSIVE,
ILockingProvider::LOCK_SHARED,
null,
0,
],

// ---- delete hook ----
Expand Down Expand Up @@ -2515,7 +2517,7 @@ public function testRemoveMoveableMountPoint(): void {
->willReturn($mountPoint);
$mount->expects($this->once())
->method('removeMount')
->willReturn('foo');
->willReturn(true);
$mount->expects($this->any())
->method('getInternalPath')
->willReturn('');
Expand Down Expand Up @@ -2548,7 +2550,7 @@ public function testRemoveMoveableMountPoint(): void {

//Delete the mountpoint
$view = new View('/' . $this->user . '/files');
$this->assertEquals('foo', $view->rmdir('mount'));
$this->assertEquals(true, $view->rmdir('mount'));
}

public function mimeFilterProvider() {
Expand Down
18 changes: 9 additions & 9 deletions tests/lib/Template/ResourceLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public function testFind(): void {
$locator = $this->getResourceLocator('theme');
$locator->expects($this->once())
->method('doFind')
->with('foo');
->with('app/foo');
$locator->expects($this->once())
->method('doFindTheme')
->with('foo');
->with('app/foo');
/** @var \OC\Template\ResourceLocator $locator */
$locator->find(['foo']);
$locator->find(['app/foo']);
}

public function testFindNotFound(): void {
Expand All @@ -59,17 +59,17 @@ public function testFindNotFound(): void {
['core' => 'map'], ['3rd' => 'party'], ['foo' => 'bar']);
$locator->expects($this->once())
->method('doFind')
->with('foo')
->will($this->throwException(new ResourceNotFoundException('foo', 'map')));
->with('app/foo')
->will($this->throwException(new ResourceNotFoundException('app/foo', 'map')));
$locator->expects($this->once())
->method('doFindTheme')
->with('foo')
->will($this->throwException(new ResourceNotFoundException('foo', 'map')));
->with('app/foo')
->will($this->throwException(new ResourceNotFoundException('app/foo', 'map')));
$this->logger->expects($this->exactly(2))
->method('debug')
->with($this->stringContains('map/foo'));
->with($this->stringContains('map/app/foo'));
/** @var \OC\Template\ResourceLocator $locator */
$locator->find(['foo']);
$locator->find(['app/foo']);
}

public function testAppendIfExist(): void {
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/TemplateFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ public function testRelativeDateLastYear(): void {
public function testRelativeDateYearsAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 365.25 * 2;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
$result = (string)relative_modified_date((int)$elementTime, $currentTime, true);

$this->assertEquals('2 years ago', $result);

$elementTime = $currentTime - 86400 * 365.25 * 3;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
$result = (string)relative_modified_date((int)$elementTime, $currentTime, true);

$this->assertEquals('3 years ago', $result);
}
Expand Down Expand Up @@ -264,12 +264,12 @@ public function testRelativeTimeLastYear(): void {
public function testRelativeTimeYearsAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 365.25 * 2;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
$result = (string)relative_modified_date((int)$elementTime, $currentTime, false);

$this->assertEquals('2 years ago', $result);

$elementTime = $currentTime - 86400 * 365.25 * 3;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
$result = (string)relative_modified_date((int)$elementTime, $currentTime, false);

$this->assertEquals('3 years ago', $result);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/User/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function testCheckPassword(): void {
$backend->expects($this->once())
->method('checkPassword')
->with($this->equalTo('foo'), $this->equalTo('bar'))
->willReturn(true);
->willReturn('foo');

$backend->expects($this->any())
->method('implementsActions')
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/User/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ public function testCreateRememberedSessionToken(): void {
->method('generateToken')
->with($sessionId, $uid, $loginName, $password, 'Firefox', IToken::TEMPORARY_TOKEN, IToken::REMEMBER);

$this->assertTrue($userSession->createSessionToken($request, $uid, $loginName, $password, true));
$this->assertTrue($userSession->createSessionToken($request, $uid, $loginName, $password, IToken::REMEMBER));
}

public function testCreateSessionTokenWithTokenPassword(): void {
Expand Down

0 comments on commit 9f70325

Please sign in to comment.