Skip to content
Snippets Groups Projects
Commit 2abe6338 authored by Vadim Justus's avatar Vadim Justus
Browse files

Introduce semver and static tests

parent 1f76010a
No related branches found
No related tags found
1 merge request!1Introduce semver and static tests
Pipeline #2124 failed
stages:
- static-tests
- integration-tests
# Static Tests
semver-tests:
stage: static-tests
tags:
- php73
variables:
EXECUTOR_SUITE: module-semver
ALLOWED_CHANGE_LEVEL: 1
before_script:
- ~/.composer/vendor/met/test-executor/run.sh setup
script:
- ~/.composer/vendor/met/test-executor/run.sh tests
after_script:
- ~/.composer/vendor/met/test-executor/run.sh cleanup
only:
- merge_requests
static-tests:
stage: static-tests
tags:
- php74
- mysql80
- es7
variables:
EXECUTOR_SUITE: module-static
MAGENTO_EDITION: community
MAGENTO_VERSION: 2.4.0
before_script:
- ~/.composer/vendor/met/test-executor/run.sh setup
script:
- ~/.composer/vendor/met/test-executor/run.sh tests
after_script:
- ~/.composer/vendor/met/test-executor/run.sh cleanup
only:
- merge_requests
# Integration tests
ce-23-integration:
stage: integration-tests
tags:
- php73
- mysql57
- es6
variables:
EXECUTOR_SUITE: module-integration
MAGENTO_EDITION: community
MAGENTO_VERSION: 2.3.*
before_script:
- ~/.composer/vendor/met/test-executor/run.sh setup
script:
- ~/.composer/vendor/met/test-executor/run.sh tests
after_script:
- ~/.composer/vendor/met/test-executor/run.sh cleanup
only:
- merge_requests
ce-24-integration:
stage: integration-tests
tags:
- php74
- mysql80
- es7
variables:
EXECUTOR_SUITE: module-integration
MAGENTO_EDITION: community
MAGENTO_VERSION: 2.4.*
before_script:
- ~/.composer/vendor/met/test-executor/run.sh setup
script:
- ~/.composer/vendor/met/test-executor/run.sh tests
after_script:
- ~/.composer/vendor/met/test-executor/run.sh cleanup
only:
- merge_requests
<?php
/**
* Copyright (c) 2020 TechDivision GmbH
* All rights reserved
*
* This product includes proprietary software developed at TechDivision GmbH, Germany
* For more information see http://www.techdivision.com/
*
* To obtain a valid license for using this software please contact us at
* license@techdivision.com
*/
declare(strict_types=1);
use Magento\Catalog\Model\Product\Type;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Address;
use Magento\Sales\Model\Order\Item;
use Magento\Sales\Model\Order\Payment;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
$addressData = [
'firstname' => 'guest',
'lastname' => 'guest',
'email' => 'customer@example.com',
'street' => 'street',
'city' => 'Los Angeles',
'region' => 'CA',
'postcode' => '1',
'country_id' => 'US',
'telephone' => '1'
];
$itemQuantitiesAndLineItems = [
0 => [
[
'qty' => 1,
],
],
1 => [
[
'qty' => 1,
],
[
'qty' => 2,
],
],
2 => [
[
'qty' => 5,
],
[
'qty' => 2,
],
[
'qty' => 3,
],
[
'qty' => 1,
],
],
3 => [
[
'qty' => 5,
],
],
4 => [
[
'qty' => 100,
],
],
5 => [
[
'qty' => 1,
],
[
'qty' => 1,
],
[
'qty' => 3,
],
[
'qty' => 1,
],
[
'qty' => 1,
],
]
];
for ($counter = 0; $counter <= 5; $counter++) {
/** @var $billingAddress Address */
$billingAddress = Bootstrap::getObjectManager()->create(Address::class, ['data' => $addressData]);
$billingAddress->setAddressType('billing');
$shippingAddress = clone $billingAddress;
$shippingAddress->setId(null)->setAddressType('shipping');
/** @var $payment Payment */
$payment = Bootstrap::getObjectManager()->create(Payment::class);
$payment->setMethod('checkmo');
/** @var StoreManagerInterface $storeManager */
$storeManager = Bootstrap::getObjectManager()->get(StoreManagerInterface::class);
/** @var $order Order */
$order = Bootstrap::getObjectManager()->create(Order::class);
$order
->setIncrementId('WORKSHOP-10' . $counter)
->setSubtotal(100 + $counter)
->setBaseSubtotal(100 + $counter)
->setCustomerIsGuest(true)
->setCustomerEmail('admin@example.com')
->setStatus('pending')
->setBillingAddress($billingAddress)
->setShippingAddress($shippingAddress)
->setStoreId($storeManager->getStore()->getId())
->setPayment($payment);
$itemQuantitiesAndLineItemsCount = count($itemQuantitiesAndLineItems[$counter]);
for ($itemCount = 0; $itemCount < $itemQuantitiesAndLineItemsCount; $itemCount++) {
/** @var $orderItem Item */
$orderItem = Bootstrap::getObjectManager()->create(Item::class);
$orderItem->setProductId($counter)
->setProductType(Type::TYPE_SIMPLE)
->setName('product name')
->setSku('WS0000-' . $counter . '-' . $itemCount)
->setBasePrice(100 + ($counter + $itemCount))
->setQtyOrdered($itemQuantitiesAndLineItems[$counter][$itemCount]['qty'])
->setQtyShipped(0)
->setIsQtyDecimal(true);
$order->addItem($orderItem);
}
/** @var OrderRepositoryInterface $orderRepository */
$orderRepository = Bootstrap::getObjectManager()->get(OrderRepositoryInterface::class);
$orderRepository->save($order);
}
<?php
/**
* Copyright (c) 2019 TechDivision GmbH
* All rights reserved
*
* This product includes proprietary software developed at TechDivision GmbH, Germany
* For more information see http://www.techdivision.com/
*
* To obtain a valid license for using this software please contact us at
* license@techdivision.com
*/
declare(strict_types=1);
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Registry;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\TestFramework\Helper\Bootstrap;
/** @var Registry $registry */
$registry = Bootstrap::getObjectManager()->get(Registry::class);
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);
/** @var OrderRepositoryInterface $orderRepository */
$orderRepository = Bootstrap::getObjectManager()->get(OrderRepositoryInterface::class);
/** @var SearchCriteriaBuilder $searchCriteriaBuilder */
$searchCriteriaBuilder = Bootstrap::getObjectManager()->get(SearchCriteriaBuilder::class);
$searchCriteria = $searchCriteriaBuilder->addFilter(
'increment_id',
'WORKSHOP-%',
'like'
)->create();
$orders = $orderRepository->getList($searchCriteria);
foreach ($orders->getItems() as $order) {
$orderRepository->delete($order);
}
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright (c) 2019 TechDivision GmbH
* All rights reserved
*
* This product includes proprietary software developed at TechDivision GmbH, Germany
* For more information see http://www.techdivision.com/
*
* To obtain a valid license for using this software please contact us at
* license@techdivision.com
*
* @copyright Copyright (c) 2019 TechDivision GmbH (http://www.techdivision.com)
* @author Vadim Justus <v.justus@techdivision.com>
* @link http://www.techdivision.com/
*/
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.2/phpunit.xsd"
colors="true"
columns="max"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="../../../../../../dev/tests/integration/framework/bootstrap.php"
stderr="true"
>
<!-- Test suites definition -->
<testsuites>
<testsuite name="Magento Integration Tests">
<directory suffix="Test.php">.</directory>
</testsuite>
</testsuites>
<!-- PHP INI settings and constants definition -->
<php>
<includePath>.</includePath>
<includePath>../../../../../../dev/tests/integration/</includePath>
<ini name="date.timezone" value="America/Los_Angeles"/>
<ini name="xdebug.max_nesting_level" value="200"/>
<!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) -->
<const name="TESTS_INSTALL_CONFIG_FILE" value="etc/install-config-mysql.php"/>
<!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) -->
<const name="TESTS_GLOBAL_CONFIG_FILE" value="etc/config-global.php"/>
<!-- Semicolon-separated 'glob' patterns, that match global XML configuration files -->
<const name="TESTS_GLOBAL_CONFIG_DIR" value="../../../app/etc"/>
<!-- Whether to cleanup the application before running tests or not -->
<const name="TESTS_CLEANUP" value="disabled"/>
<!-- Memory usage and estimated leaks thresholds -->
<!--<const name="TESTS_MEM_USAGE_LIMIT" value="1024M"/>-->
<const name="TESTS_MEM_LEAK_LIMIT" value=""/>
<!-- Path to Percona Toolkit bin directory -->
<!--<const name="PERCONA_TOOLKIT_BIN_DIR" value=""/>-->
<!-- CSV Profiler Output file -->
<!--<const name="TESTS_PROFILER_FILE" value="profiler.csv"/>-->
<!-- Bamboo compatible CSV Profiler Output file name -->
<!--<const name="TESTS_BAMBOO_PROFILER_FILE" value="profiler.csv"/>-->
<!-- Metrics for Bamboo Profiler Output in PHP file that returns array -->
<!--<const name="TESTS_BAMBOO_PROFILER_METRICS_FILE" value="../../build/profiler_metrics.php"/>-->
<!-- Whether to output all CLI commands executed by the bootstrap and tests -->
<const name="TESTS_EXTRA_VERBOSE_LOG" value="1"/>
<!-- Magento mode for tests execution. Possible values are "default", "developer" and "production". -->
<const name="TESTS_MAGENTO_MODE" value="developer"/>
<!-- Minimum error log level to listen for. Possible values: -1 ignore all errors, and level constants form http://tools.ietf.org/html/rfc5424 standard -->
<const name="TESTS_ERROR_LOG_LISTENER_LEVEL" value="-1"/>
<!-- Connection parameters for MongoDB library tests -->
<!--<const name="MONGODB_CONNECTION_STRING" value="mongodb://localhost:27017"/>-->
<!--<const name="MONGODB_DATABASE_NAME" value="magento_integration_tests"/>-->
</php>
<!-- Test listeners -->
<listeners>
<listener class="Magento\TestFramework\Event\PhpUnit"/>
<listener class="Magento\TestFramework\ErrorLog\Listener"/>
</listeners>
</phpunit>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment