can get endpoints raw element, get entity by a separate call

This commit is contained in:
2025-01-04 22:37:16 +01:00
parent 55bad44a22
commit a88bb6d33f
12 changed files with 64 additions and 29 deletions

View File

@ -136,6 +136,7 @@ class AccountTest extends IntegrationTestCase
* @test
* @throws ReflectionException
* @covers \D3\KlicktippPhpClient\Resources\Account::get
* @covers \D3\KlicktippPhpClient\Resources\Account::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
@ -148,7 +149,7 @@ class AccountTest extends IntegrationTestCase
$return = $this->callMethod(
$sut,
'get'
'getEntity'
);
$this->assertInstanceOf(AccountEntity::class, $return);

View File

@ -99,6 +99,7 @@ class FieldTest extends IntegrationTestCase
* @test
* @throws ReflectionException
* @covers \D3\KlicktippPhpClient\Resources\Field::get
* @covers \D3\KlicktippPhpClient\Resources\Field::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
@ -111,7 +112,7 @@ class FieldTest extends IntegrationTestCase
$return = $this->callMethod(
$sut,
'get',
'getEntity',
['12514414']
);

View File

@ -93,6 +93,7 @@ class SubscriberTest extends IntegrationTestCase
* @test
* @throws ReflectionException
* @covers \D3\KlicktippPhpClient\Resources\Subscriber::get
* @covers \D3\KlicktippPhpClient\Resources\Subscriber::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
@ -105,7 +106,7 @@ class SubscriberTest extends IntegrationTestCase
$return = $this->callMethod(
$sut,
'get',
'getEntity',
['155988456']
);
@ -622,14 +623,14 @@ class SubscriberTest extends IntegrationTestCase
$sut = $this->getMockBuilder(Subscriber::class)
->setConstructorArgs([$this->getConnectionMock($responses)])
->onlyMethods(['search', 'update', 'subscribe', 'get'])
->onlyMethods(['search', 'update', 'subscribe', 'getEntity'])
->getMock();
$sut->expects($this->once())->method('search')->will(
$foundId ? $this->returnValue($foundId) : $this->throwException(new BaseException())
);
$sut->expects($updateInvocations)->method('update')->willReturn(true);
$sut->expects($subscribeInvocations)->method('subscribe')->willReturn('myId');
$sut->expects($this->once())->method('get')->with(
$sut->expects($this->once())->method('getEntity')->with(
$this->identicalTo('myId')
)->willReturn($entityMock);
@ -678,10 +679,10 @@ class SubscriberTest extends IntegrationTestCase
$sut = $this->getMockBuilder(Subscriber::class)
->setConstructorArgs([$this->getConnectionMock($responses)])
->onlyMethods(['search', 'get'])
->onlyMethods(['search', 'getEntity'])
->getMock();
$sut->expects($this->once())->method('search')->willReturn('myId');
$sut->expects($this->once())->method('get')->with(
$sut->expects($this->once())->method('getEntity')->with(
$this->identicalTo('myId')
)->willReturn(new SubscriberEntity());

View File

@ -70,6 +70,7 @@ class SubscriptionProcessTest extends IntegrationTestCase
* @test
* @throws ReflectionException
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::get
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?Subscription $expected, bool $expectException = false)
@ -84,7 +85,7 @@ class SubscriptionProcessTest extends IntegrationTestCase
$expected,
$this->callMethod(
$sut,
'get',
'getEntity',
['470370']
)
);

View File

@ -70,6 +70,7 @@ class TagTest extends IntegrationTestCase
* @test
* @throws ReflectionException
* @covers \D3\KlicktippPhpClient\Resources\Tag::get
* @covers \D3\KlicktippPhpClient\Resources\Tag::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
@ -82,7 +83,7 @@ class TagTest extends IntegrationTestCase
$return = $this->callMethod(
$sut,
'get',
'getEntity',
['12514414']
);