diff --git a/src/Resources/Subscriber.php b/src/Resources/Subscriber.php index d69050d..db8046d 100644 --- a/src/Resources/Subscriber.php +++ b/src/Resources/Subscriber.php @@ -220,9 +220,9 @@ class Subscriber extends Model /** * @throws BaseException */ - public function tagged(string $tagId): array + public function tagged(string $tagId): SubscriberList { - return $this->connection->requestAndParse( + $data = $this->connection->requestAndParse( 'POST', 'subscriber/tagged.json', [ @@ -231,6 +231,8 @@ class Subscriber extends Model ], ] ) ?? []; + + return new SubscriberList($data); } /** diff --git a/tests/integration/Resources/SubscriberTest.php b/tests/integration/Resources/SubscriberTest.php index 13f598d..80d42e8 100644 --- a/tests/integration/Resources/SubscriberTest.php +++ b/tests/integration/Resources/SubscriberTest.php @@ -413,14 +413,14 @@ class SubscriberTest extends IntegrationTestCase $this->expectException(BaseException::class); } - $this->assertEquals( - $expected, - $this->callMethod( - $sut, - 'tagged', - ['2354758'] - ) + $return = $this->callMethod( + $sut, + 'tagged', + ['2354758'] ); + + $this->assertInstanceOf(SubscriberList::class, $return); + $this->assertSame($expected, $return->toArray()); } public static function taggedDataProvider(): Generator