diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index a9a1bd3..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -reports/ diff --git a/tests/Integration/Application/Controller/Admin/AdminOrderTest.php b/tests/Integration/Application/Controller/Admin/AdminOrderTest.php deleted file mode 100644 index 9f0d4a2..0000000 --- a/tests/Integration/Application/Controller/Admin/AdminOrderTest.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @link https://www.oxidmodule.com - */ - -declare(strict_types=1); - -namespace D3\Linkmobility4OXID\Tests\Integration\Application\Controller\Admin; - -use D3\Linkmobility4OXID\Application\Controller\Admin\AdminOrder; -use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; - -class AdminOrderTest extends d3ModCfgUnitTestCase -{ - /** @var AdminOrder */ - protected $controller; - - public function setUp() - { - parent::setUp(); - - $this->controller = oxNew(AdminOrder::class); - } - - public function tearDown() - { - parent::tearDown(); - - unset($this->controller); - } - - /** - * @test - * @return void - * @throws \ReflectionException - */ - public function testSend() - { - $this->callMethod( - $this->controller, - 'send' - ); - } -} \ No newline at end of file diff --git a/tests/Integration/Application/Model/MessageTypes/SmsTest.php b/tests/Integration/Application/Model/MessageTypes/SmsTest.php deleted file mode 100644 index fe44959..0000000 --- a/tests/Integration/Application/Model/MessageTypes/SmsTest.php +++ /dev/null @@ -1,139 +0,0 @@ - - * @link https://www.oxidmodule.com - */ - -declare(strict_types=1); - -namespace D3\Linkmobility4OXID\Tests\Integration\Application\Model\MessageTypes; - -use D3\Linkmobility4OXID\Application\Model\Configuration; -use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms; -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\Order; -use OxidEsales\Eshop\Application\Model\Remark; -use OxidEsales\Eshop\Core\Registry; -use OxidEsales\PayPalModule\Model\User; -use PHPUnit\Framework\MockObject\MockObject; -use ReflectionException; - -class SmsTest extends d3ModCfgUnitTestCase -{ - /** @var Sms */ - protected $model; - protected $countryId = 'countryIdNo1'; - protected $userId = 'userIdNo1'; - protected $exampleNumber; - - public function setUp() - { - parent::setUp(); - - $this->model = oxNew(Sms::class, 'demomessage'); - - $this->addObjects(); - - $phoneUtil = PhoneNumberUtil::getInstance(); - $example = $phoneUtil->getExampleNumberForType('DE', PhoneNumberType::MOBILE); - $this->exampleNumber = $phoneUtil->format($example, PhoneNumberFormat::NATIONAL); - } - - public function addObjects() - { - $country = oxNew(Country::class); - $country->setId($this->countryId); - $country->assign([ - 'oxisoalpha2' => 'DE' - ]); - $country->save(); - - //$user = new User(); - //$user->setId($this->userId); - //$user->save(); - } - - public function tearDown() - { - parent::tearDown(); - - $this->clearObjects(); - - unset($this->model); - } - - public function clearObjects() - { - $country = oxNew(Country::class); - $country->delete($this->countryId); - - $user = oxNew(User::class); - $user->delete($this->userId); - } - - /** - * @test - * @return void - * @throws ReflectionException - */ - public function testSendOrderMessage() - { - Registry::getConfig()->setConfigParam(Configuration::DEBUG, true); - - /** @var User $user */ - //$user = oxNew(User::class); - //$user->load($this->userId); - - /** @var Order|MockObject $orderMock */ - $orderMock = $this->getMockBuilder(Order::class) - ->setMethods([ - 'getFieldData', - 'getOrderUser' - ]) - ->disableOriginalConstructor() - ->getMock(); - $orderMock->method('getFieldData')->willReturnCallback([$this, 'orderFieldDataCallback']); - $orderMock->method('getOrderUser')->willReturn($user); - - $this->assertTrue( - $this->callMethod( - $this->model, - 'sendOrderMessage', - [$orderMock] - ) - ); - - $remark = oxNew(Remark::class); -dumpvar($remark); - // $remarkId = "SELECT oxid FROM ".$remark->getViewName()." WHERE " - // $this->assertTrue( - - // ) - } - - public function orderFieldDataCallback() - { - $aArgs = func_get_args(); - - switch ($aArgs[0]) { - case 'oxdelfon': - case 'oxbillfon': - return $this->exampleNumber; - case 'oxdelcountryid': - return $this->countryId; - } - - $this->fail('Unknown variable '.$aArgs[0]); - } -} \ No newline at end of file diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 04fe209..0000000 --- a/tests/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# D3 Linkmobility4Oxid Tests - -## Requirements - -Both unit and acceptance tests require OXID Testing Library installed. -See https://github.com/OXID-eSales/testing_library - -### Configuration - -Set up the module completely with your personal data (API Key, transmitter, country code). These will be used to test the successful configuration. - -Please install the packages listed in the composer.json in "require-dev". Unfortunately Composer does not provide an automatic installation. - -Here is an example of Testing Library configuration file `oxideshop/test_config.yml` - -``` -# This file is auto-generated during the composer install -mandatory_parameters: - shop_path: /var/www/oxideshop/source - shop_tests_path: /var/www/oxideshop/tests - partial_module_paths: d3/linkmobilty -optional_parameters: - shop_url: null - shop_serial: '' - enable_varnish: false - is_subshop: false - install_shop: false - remote_server_dir: null - shop_setup_path: null - restore_shop_after_tests_suite: false - test_database_name: null - restore_after_acceptance_tests: false - restore_after_unit_tests: false - tmp_path: /tmp/oxid_test_library/ - database_restoration_class: DatabaseRestorer - activate_all_modules: false - run_tests_for_shop: false - run_tests_for_modules: true - screen_shots_path: null - screen_shots_url: null - browser_name: firefox - selenium_server_ip: 127.0.0.1 - selenium_server_port: '4444' - additional_test_paths: null -``` - -## Unit Tests - -To execute unit tests run the following: - -``` -cd /var/www/oxideshop/ -./vendor/bin/runtests -``` -or for single tests -``` -cd /var/www/oxideshop/ -./vendor/bin/runtests /var/www/html/vendor/d3/linkmobility4oxid/tests/... -``` \ No newline at end of file diff --git a/tests/additional.inc.php b/tests/additional.inc.php deleted file mode 100644 index 12f5e8d..0000000 --- a/tests/additional.inc.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @link https://www.oxidmodule.com - */ - -declare(strict_types=1); - -// Include modules test config -namespace D3\Linkmobility4OXID\tests; - -use D3\ModCfg\Tests\additional_abstract; -use OxidEsales\Eshop\Core\Exception\StandardException; - -include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'd3linkmobility_config.php'); - -class additional extends additional_abstract -{ - /** - * additional constructor. - * @throws StandardException - */ - public function __construct() - { - if (D3LINKMOBILITY_REQUIRE_MODCFG) { - $this->reactivateModCfg(); - } - } -} - -oxNew(additional::class); \ No newline at end of file diff --git a/tests/d3linkmobility_config.php b/tests/d3linkmobility_config.php deleted file mode 100644 index 2f4f746..0000000 --- a/tests/d3linkmobility_config.php +++ /dev/null @@ -1,17 +0,0 @@ - - * @link https://www.oxidmodule.com - */ - -declare(strict_types=1); - -define('D3LINKMOBILTY_REQUIRE_MODCFG', true); - diff --git a/tests/phpunit.xml b/tests/phpunit.xml deleted file mode 100644 index 8852fef..0000000 --- a/tests/phpunit.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - ../Application - ../Modules - - - - - -