add subscription process delete endpoint
Dieser Commit ist enthalten in:
Ursprung
abcfea9480
Commit
395d6c3b2e
@ -102,4 +102,17 @@ class SubscriptionProcess extends Model
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException
|
||||
*/
|
||||
public function delete(string $listId): bool
|
||||
{
|
||||
return (bool) current(
|
||||
$this->connection->requestAndParse(
|
||||
'DELETE',
|
||||
'list/'.urlencode(trim($listId)).'.json'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -199,4 +199,34 @@ class SubscriptionProcessTest extends IntegrationTestCase
|
||||
yield 'missing or empty list id' => [new Response(404, [], '["Kein Opt-In-Prozess mit dieser ID."]'), null, true];
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws ReflectionException
|
||||
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::delete
|
||||
* @dataProvider deleteDataProvider
|
||||
*/
|
||||
public function testDelete(ResponseInterface $response, ?bool $expected, bool $expectException = false): void
|
||||
{
|
||||
$sut = new SubscriptionProcess($this->getConnectionMock($response));
|
||||
|
||||
if ($expectException) {
|
||||
$this->expectException(BaseException::class);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$this->callMethod(
|
||||
$sut,
|
||||
'delete',
|
||||
['2354758']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function deleteDataProvider(): Generator
|
||||
{
|
||||
yield 'success' => [new Response(200, [], '[true]'), true];
|
||||
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||
}
|
||||
}
|
||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren