use generated example phone number
This commit is contained in:
@ -25,7 +25,7 @@ class Configuration
|
|||||||
*/
|
*/
|
||||||
public function getApiToken(): string
|
public function getApiToken(): string
|
||||||
{
|
{
|
||||||
$token = trim(Registry::getConfig()->getConfigParam('d3linkmobility_apitoken'));
|
$token = trim((string) Registry::getConfig()->getConfigParam('d3linkmobility_apitoken'));
|
||||||
|
|
||||||
Assert::that($token)->string()->notEmpty();
|
Assert::that($token)->string()->notEmpty();
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ use D3\Linkmobility4OXID\Application\Model\UserRecipients;
|
|||||||
use D3\LinkmobilityClient\Exceptions\ApiException;
|
use D3\LinkmobilityClient\Exceptions\ApiException;
|
||||||
use D3\LinkmobilityClient\Request\RequestInterface;
|
use D3\LinkmobilityClient\Request\RequestInterface;
|
||||||
use D3\LinkmobilityClient\SMS\SmsRequestInterface;
|
use D3\LinkmobilityClient\SMS\SmsRequestInterface;
|
||||||
|
use D3\LinkmobilityClient\ValueObject\Recipient;
|
||||||
use D3\LinkmobilityClient\ValueObject\Sender;
|
use D3\LinkmobilityClient\ValueObject\Sender;
|
||||||
use Exception;
|
use Exception;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
|
@ -13,11 +13,13 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace D3\Linkmobility4OXID\Tests\Application\Model;
|
namespace D3\Linkmobility4OXID\Tests\Application\Model\MessageTypes;
|
||||||
|
|
||||||
use D3\Linkmobility4OXID\Application\Controller\Admin\AdminOrder;
|
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
|
||||||
use D3\Linkmobility4OXID\Application\Model\Sms;
|
|
||||||
use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase;
|
use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase;
|
||||||
|
use libphonenumber\PhoneNumberFormat;
|
||||||
|
use libphonenumber\PhoneNumberType;
|
||||||
|
use libphonenumber\PhoneNumberUtil;
|
||||||
use OxidEsales\Eshop\Application\Model\Country;
|
use OxidEsales\Eshop\Application\Model\Country;
|
||||||
use OxidEsales\Eshop\Application\Model\Order;
|
use OxidEsales\Eshop\Application\Model\Order;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
@ -28,6 +30,7 @@ class SmsTest extends d3ModCfgUnitTestCase
|
|||||||
/** @var Sms */
|
/** @var Sms */
|
||||||
protected $model;
|
protected $model;
|
||||||
protected $countryId = 'countryIdNo1';
|
protected $countryId = 'countryIdNo1';
|
||||||
|
protected $exampleNumber;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
@ -41,6 +44,10 @@ class SmsTest extends d3ModCfgUnitTestCase
|
|||||||
'oxisoalpha2' => 'DE'
|
'oxisoalpha2' => 'DE'
|
||||||
]);
|
]);
|
||||||
$country->save();
|
$country->save();
|
||||||
|
|
||||||
|
$phoneUtil = PhoneNumberUtil::getInstance();
|
||||||
|
$example = $phoneUtil->getExampleNumberForType('DE', PhoneNumberType::MOBILE);
|
||||||
|
$this->exampleNumber = $phoneUtil->format($example, PhoneNumberFormat::NATIONAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
@ -82,11 +89,10 @@ class SmsTest extends d3ModCfgUnitTestCase
|
|||||||
|
|
||||||
switch ($aArgs[0]) {
|
switch ($aArgs[0]) {
|
||||||
case 'oxdelfon':
|
case 'oxdelfon':
|
||||||
return '015792300219';
|
case 'oxbillfon':
|
||||||
|
return $this->exampleNumber;
|
||||||
case 'oxdelcountryid':
|
case 'oxdelcountryid':
|
||||||
return $this->countryId;
|
return $this->countryId;
|
||||||
case 'oxbillfon':
|
|
||||||
return '015792300219';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->fail('Unknown variable '.$aArgs[0]);
|
$this->fail('Unknown variable '.$aArgs[0]);
|
Reference in New Issue
Block a user