use generated example phone number

Cette révision appartient à :
Daniel Seifert 2022-07-15 23:54:52 +02:00
Parent 23de1d2f06
révision 4e5147a0ac
Signé par: DanielS
ID de la clé GPG: 6A513E13AEE66170
4 fichiers modifiés avec 35 ajouts et 5 suppressions

Voir le fichier

@ -22,6 +22,7 @@ use D3\LinkmobilityClient\Tests\ApiTestCase;
use D3\LinkmobilityClient\ValueObject\Recipient; use D3\LinkmobilityClient\ValueObject\Recipient;
use libphonenumber\NumberParseException; use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumber; use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberType; use libphonenumber\PhoneNumberType;
use libphonenumber\PhoneNumberUtil; use libphonenumber\PhoneNumberUtil;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
@ -35,7 +36,7 @@ class RecipientsListTest extends ApiTestCase
/** @var RecipientsList */ /** @var RecipientsList */
public $recipientsList; public $recipientsList;
private $phoneNumberFixture = '01527565839'; private $phoneNumberFixture;
private $phoneCountryFixture = 'DE'; private $phoneCountryFixture = 'DE';
/** /**
@ -51,6 +52,10 @@ class RecipientsListTest extends ApiTestCase
->getMock(); ->getMock();
$this->recipientsList = new RecipientsList($clientMock); $this->recipientsList = new RecipientsList($clientMock);
$phoneUtil = PhoneNumberUtil::getInstance();
$example = $phoneUtil->getExampleNumberForType($this->phoneCountryFixture, PhoneNumberType::MOBILE);
$this->phoneNumberFixture = $phoneUtil->format($example, PhoneNumberFormat::NATIONAL);
} }
/** /**

Voir le fichier

@ -24,6 +24,9 @@ use D3\LinkmobilityClient\SMS\Response;
use D3\LinkmobilityClient\Tests\ApiTestCase; use D3\LinkmobilityClient\Tests\ApiTestCase;
use D3\LinkmobilityClient\ValueObject\Recipient; use D3\LinkmobilityClient\ValueObject\Recipient;
use D3\LinkmobilityClient\ValueObject\Sender; use D3\LinkmobilityClient\ValueObject\Sender;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberType;
use libphonenumber\PhoneNumberUtil;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;
@ -112,7 +115,11 @@ abstract class AbstractRequest extends ApiTestCase
*/ */
public function validatePassedTest() public function validatePassedTest()
{ {
$recipient = new Recipient('015792300219', 'DE'); $phoneUtil = PhoneNumberUtil::getInstance();
$example = $phoneUtil->getExampleNumberForType('DE', PhoneNumberType::MOBILE);
$phoneNumberFixture = $phoneUtil->format($example, PhoneNumberFormat::NATIONAL);
$recipient = new Recipient($phoneNumberFixture, 'DE');
/** @var Request|MockObject $requestMock */ /** @var Request|MockObject $requestMock */
$requestMock = $this->getMockBuilder($this->testClassName) $requestMock = $this->getMockBuilder($this->testClassName)
@ -139,7 +146,11 @@ abstract class AbstractRequest extends ApiTestCase
*/ */
public function validateFailedTest() public function validateFailedTest()
{ {
$recipient = new Recipient('015792300219', 'DE'); $phoneUtil = PhoneNumberUtil::getInstance();
$example = $phoneUtil->getExampleNumberForType('DE', PhoneNumberType::MOBILE);
$phoneNumberFixture = $phoneUtil->format($example, PhoneNumberFormat::NATIONAL);
$recipient = new Recipient($phoneNumberFixture, 'DE');
/** @var Request|MockObject $requestMock */ /** @var Request|MockObject $requestMock */
$requestMock = $this->getMockBuilder($this->testClassName) $requestMock = $this->getMockBuilder($this->testClassName)

Voir le fichier

@ -20,6 +20,8 @@ use D3\LinkmobilityClient\Tests\ApiTestCase;
use D3\LinkmobilityClient\ValueObject\Recipient; use D3\LinkmobilityClient\ValueObject\Recipient;
use libphonenumber\NumberParseException; use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumber; use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberType;
use libphonenumber\PhoneNumberUtil; use libphonenumber\PhoneNumberUtil;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException; use ReflectionException;
@ -29,7 +31,7 @@ class RecipientTest extends ApiTestCase
/** @var Recipient */ /** @var Recipient */
public $recipient; public $recipient;
private $phoneNumberFixture = '01527565839'; private $phoneNumberFixture;
private $phoneCountryFixture = 'DE'; private $phoneCountryFixture = 'DE';
/** /**
@ -40,6 +42,10 @@ class RecipientTest extends ApiTestCase
{ {
parent::setUp(); parent::setUp();
$phoneUtil = PhoneNumberUtil::getInstance();
$example = $phoneUtil->getExampleNumberForType($this->phoneCountryFixture, PhoneNumberType::MOBILE);
$this->phoneNumberFixture = $phoneUtil->format($example, PhoneNumberFormat::NATIONAL);
$this->recipient = new Recipient($this->phoneNumberFixture, $this->phoneCountryFixture); $this->recipient = new Recipient($this->phoneNumberFixture, $this->phoneCountryFixture);
} }

Voir le fichier

@ -21,6 +21,8 @@ use D3\LinkmobilityClient\Tests\ApiTestCase;
use D3\LinkmobilityClient\ValueObject\Sender; use D3\LinkmobilityClient\ValueObject\Sender;
use libphonenumber\NumberParseException; use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumber; use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberType;
use libphonenumber\PhoneNumberUtil; use libphonenumber\PhoneNumberUtil;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException; use ReflectionException;
@ -30,7 +32,7 @@ class SenderTest extends ApiTestCase
/** @var Sender */ /** @var Sender */
public $sender; public $sender;
private $phoneNumberFixture = '015792300219'; private $phoneNumberFixture;
private $phoneCountryFixture = 'DE'; private $phoneCountryFixture = 'DE';
/** /**
@ -42,7 +44,13 @@ class SenderTest extends ApiTestCase
{ {
parent::setUp(); parent::setUp();
$phoneUtil = PhoneNumberUtil::getInstance();
$example = $phoneUtil->getExampleNumberForType($this->phoneCountryFixture, PhoneNumberType::MOBILE);
$this->phoneNumberFixture = $phoneUtil->format($example, PhoneNumberFormat::NATIONAL);
$this->sender = new Sender($this->phoneNumberFixture, $this->phoneCountryFixture); $this->sender = new Sender($this->phoneNumberFixture, $this->phoneCountryFixture);
} }
/** /**