make deprecated client argument optional in recipients list

This commit is contained in:
Daniel Seifert 2023-01-17 15:36:50 +01:00
parent 54cfb2645c
commit 6c5a83a8a8
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
6 changed files with 12 additions and 13 deletions

View File

@ -31,7 +31,7 @@ abstract class ApiTestCase extends TestCase
* @return mixed * @return mixed
* @throws ReflectionException * @throws ReflectionException
*/ */
public function callMethod(object $object, string $methodName, array $arguments = []) public function callMethod($object, string $methodName, array $arguments = [])
{ {
$class = new ReflectionClass($object); $class = new ReflectionClass($object);
$method = $class->getMethod($methodName); $method = $class->getMethod($methodName);
@ -47,7 +47,7 @@ abstract class ApiTestCase extends TestCase
* @param $value * @param $value
* @throws ReflectionException * @throws ReflectionException
*/ */
public function setValue(object $object, string $valueName, $value) public function setValue($object, string $valueName, $value)
{ {
$reflection = new ReflectionClass($object); $reflection = new ReflectionClass($object);
$property = $reflection->getProperty($valueName); $property = $reflection->getProperty($valueName);
@ -63,7 +63,7 @@ abstract class ApiTestCase extends TestCase
* @return mixed * @return mixed
* @throws ReflectionException * @throws ReflectionException
*/ */
public function getValue(object $object, string $valueName) public function getValue($object, string $valueName)
{ {
$reflection = new ReflectionClass($object); $reflection = new ReflectionClass($object);
$property = $reflection->getProperty($valueName); $property = $reflection->getProperty($valueName);

View File

@ -15,9 +15,8 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\Tests\ValueObject; namespace D3\LinkmobilityClient\Tests\ValueObject;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Tests\ApiTestCase;
use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage; use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage;
use Phlib\SmsLength\Exception\InvalidArgumentException;
use Phlib\SmsLength\SmsLength; use Phlib\SmsLength\SmsLength;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException; use ReflectionException;
@ -94,7 +93,7 @@ class SmsBinaryMessageTest extends SmsMessageAbstractTest
if ($valid) { if ($valid) {
$smsLengthMock->expects($this->never())->method('validate')->willReturn(true); $smsLengthMock->expects($this->never())->method('validate')->willReturn(true);
} else { } else {
$smsLengthMock->expects($this->atLeastOnce())->method('validate')->willThrowException(new \Phlib\SmsLength\Exception\InvalidArgumentException()); $smsLengthMock->expects($this->atLeastOnce())->method('validate')->willThrowException(new InvalidArgumentException());
} }
/** @var SmsBinaryMessage|MockObject $message */ /** @var SmsBinaryMessage|MockObject $message */

View File

@ -19,7 +19,6 @@ use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Tests\ApiTestCase; use D3\LinkmobilityClient\Tests\ApiTestCase;
use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage; use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage;
use Phlib\SmsLength\SmsLength; use Phlib\SmsLength\SmsLength;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException; use ReflectionException;
abstract class SmsMessageAbstractTest extends ApiTestCase abstract class SmsMessageAbstractTest extends ApiTestCase

View File

@ -32,12 +32,14 @@ class RecipientsList implements RecipientsListInterface, Iterator
private $recipients = []; private $recipients = [];
/** /**
* @deprecated unused client parameter will removed * @deprecated unused client parameter will remove
* @param Client $client * @param Client|null $client
*/ */
public function __construct(Client $client) public function __construct(Client $client = null)
{ {
$this->setClient($client); if ($client) {
$this->setClient( $client );
}
} }
/** /**

View File

@ -21,7 +21,7 @@ use D3\LinkmobilityClient\ValueObject\Recipient;
interface RecipientsListInterface interface RecipientsListInterface
{ {
/** /**
* @deprecated unused client parameter will removed * @deprecated unused client parameter will remove
* @param Client $client * @param Client $client
*/ */
public function __construct(Client $client); public function __construct(Client $client);

View File

@ -25,7 +25,6 @@ use D3\LinkmobilityClient\ValueObject\Recipient;
use D3\LinkmobilityClient\ValueObject\Sender; use D3\LinkmobilityClient\ValueObject\Sender;
use D3\LinkmobilityClient\ValueObject\SmsMessageAbstract; use D3\LinkmobilityClient\ValueObject\SmsMessageAbstract;
use D3\LinkmobilityClient\ValueObject\SmsMessageInterface; use D3\LinkmobilityClient\ValueObject\SmsMessageInterface;
use D3\LinkmobilityClient\ValueObject\StringValueObject;
use GuzzleHttp\RequestOptions; use GuzzleHttp\RequestOptions;
use InvalidArgumentException; use InvalidArgumentException;