![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-ups/Test/Unit/Model/Config/Backend/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Ups\Test\Unit\Model\Config\Backend; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Ups\Model\Config\Backend\UpsUrl; use PHPUnit\Framework\TestCase; /** * Verify behavior of UpsUrl backend type */ class UpsUrlTest extends TestCase { /** * @var UpsUrl */ private $config; protected function setUp(): void { $objectManager = new ObjectManager($this); /** @var UpsUrl $upsUrl */ $this->config = $objectManager->getObject(UpsUrl::class); } /** * @dataProvider validDataProvider * @param string $data The valid data */ public function testBeforeSave($data = null) { $this->config->setValue($data); $this->config->beforeSave(); } /** * @dataProvider invalidDataProvider * @param string $data The invalid data */ public function testBeforeSaveErrors($data) { $this->expectException('Magento\Framework\Exception\ValidatorException'); $this->expectExceptionMessage('UPS API endpoint URL\'s must use ups.com'); $this->config->setValue($data); $this->config->beforeSave(); } public function validDataProvider() { return [ [], [null], [''], ['http://ups.com'], ['https://foo.ups.com'], ['http://foo.ups.com/foo/bar?baz=bash&fizz=buzz'], ]; } public function invalidDataProvider() { return [ ['http://upsfoo.com'], ['https://fooups.com'], ['https://ups.com.fake.com'], ['https://ups.info'], ['http://ups.com.foo.com/foo/bar?baz=bash&fizz=buzz'], ['http://fooups.com/foo/bar?baz=bash&fizz=buzz'], ]; } }