Skip to content

Commit

Permalink
Fix type mismatch in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin de Keijzer committed Dec 6, 2022
1 parent 36bf3b8 commit e23432f
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions tests/SoundCloudAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function testGetUser(): void
->withConsecutive(
['GET', 'me'],
['GET', 'users/1234']
)->willReturn('{"OK"}');
)->willReturn(['OK']);

self::assertEquals('{"OK"}', $this->api->getUser());
self::assertEquals('{"OK"}', $this->api->getUser(1234));
self::assertEquals(['OK'], $this->api->getUser());
self::assertEquals(['OK'], $this->api->getUser(1234));
}

/**
Expand All @@ -80,9 +80,9 @@ public function testGetTrack(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('GET', 'tracks/123')
->willReturn('{"OK"}');
->willReturn(['OK']);

self::assertEquals('{"OK"}', $this->api->getTrack(123));
self::assertEquals(['OK'], $this->api->getTrack(123));
}

/**
Expand All @@ -93,9 +93,9 @@ public function testDeleteTrack(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('DELETE', 'tracks/789')
->willReturn('{"OK"}');
->willReturn(['OK']);

self::assertEquals('{"OK"}', $this->api->deleteTrack(789));
self::assertEquals(['OK'], $this->api->deleteTrack(789));
}

/**
Expand All @@ -106,9 +106,9 @@ public function testGetStreamUrlsForTrack(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('GET', 'tracks/555/streams')
->willReturn('{"OK"}');
->willReturn(['OK']);

self::assertEquals('{"OK"}', $this->api->getStreamUrlsForTrack(555));
self::assertEquals(['OK'], $this->api->getStreamUrlsForTrack(555));
}

/**
Expand All @@ -119,9 +119,9 @@ public function testGetTrackSecretToken(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('GET', 'tracks/456?secret_token=unittest')
->willReturn('{"OK"}');
->willReturn(['OK']);

self::assertEquals('{"OK"}', $this->api->getTrack(456, 'unittest'));
self::assertEquals(['OK'], $this->api->getTrack(456, 'unittest'));
}

/**
Expand All @@ -134,10 +134,10 @@ public function testGetTracks(): void
->withConsecutive(
['GET', 'me/tracks'],
['GET', 'users/4321/tracks']
)->willReturn('{"OK"}');
)->willReturn(['OK']);

self::assertEquals('{"OK"}', $this->api->getTracks());
self::assertEquals('{"OK"}', $this->api->getTracks(4321));
self::assertEquals(['OK'], $this->api->getTracks());
self::assertEquals(['OK'], $this->api->getTracks(4321));
}

/**
Expand All @@ -148,9 +148,9 @@ public function testRepostTrack(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('PUT', 'e1/me/track_reposts/1337')
->willReturn('{}');
->willReturn([]);

self::assertEquals('{}', $this->api->repostTrack(1337));
self::assertEquals([], $this->api->repostTrack(1337));
}

/**
Expand All @@ -161,9 +161,9 @@ public function testLikeTrack(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('PUT', 'e1/me/track_likes/555')
->willReturn('{}');
->willReturn([]);

self::assertEquals('{}', $this->api->likeTrack(555));
self::assertEquals([], $this->api->likeTrack(555));
}

/**
Expand All @@ -178,9 +178,9 @@ public function testCommentOnTrack(): void
'tracks/123/comments',
[],
['comment[body]' => 'Test', 'comment[timestamp]' => 0]
)->willReturn('{}');
)->willReturn([]);

self::assertEquals('{}', $this->api->commentOnTrack(123, 'Test'));
self::assertEquals([], $this->api->commentOnTrack(123, 'Test'));
}

/**
Expand All @@ -191,9 +191,9 @@ public function testFollowUser(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('PUT', 'me/followings/222')
->willReturn('{}');
->willReturn([]);

self::assertEquals('{}', $this->api->followUser(222));
self::assertEquals([], $this->api->followUser(222));
}

/**
Expand All @@ -204,9 +204,9 @@ public function testUnFollowUser(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('DELETE', 'me/followings/333')
->willReturn('{}');
->willReturn([]);

self::assertEquals('{}', $this->api->unFollowUser(333));
self::assertEquals([], $this->api->unFollowUser(333));
}

/**
Expand All @@ -217,9 +217,9 @@ public function testFollowings(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('GET', 'me/followings')
->willReturn('{}');
->willReturn([]);

self::assertEquals('{}', $this->api->getFollowings());
self::assertEquals([], $this->api->getFollowings());
}

/**
Expand All @@ -230,9 +230,9 @@ public function testResolveUrl(): void
$this->client->expects(static::once())
->method('apiRequest')
->with('GET', 'resolve?url=https://soundcloud.com/test')
->willReturn('{}');
->willReturn([]);

self::assertEquals('{}', $this->api->resolveUrl('https://soundcloud.com/test'));
self::assertEquals([], $this->api->resolveUrl('https://soundcloud.com/test'));
}

/**
Expand Down Expand Up @@ -286,9 +286,9 @@ public function testAuthenticate(): void
'oauth2/token',
['Content-Type' => 'application/x-www-form-urlencoded'],
'client_id=&client_secret=secret&grant_type=client_credentials'
)->willReturn('{}');
)->willReturn([]);

self::assertEquals('{}', $this->api->authenticate('secret'));
self::assertEquals([], $this->api->authenticate('secret'));
}

/**
Expand All @@ -303,8 +303,8 @@ public function testRefreshToken(): void
'oauth2/token',
['Content-Type' => 'application/x-www-form-urlencoded'],
'client_id=&client_secret=secret&grant_type=refresh_token&refresh_token=refresh'
)->willReturn('{}');
)->willReturn([]);

self::assertEquals('{}', $this->api->refreshToken('secret', 'refresh'));
self::assertEquals([], $this->api->refreshToken('secret', 'refresh'));
}
}

0 comments on commit e23432f

Please sign in to comment.