init
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
/phpunit.xml
|
||||
/var/allure-results/
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . "/../../config/AllureConfig.php";
|
||||
|
||||
$outputDirectory = __DIR__ . '/../var/allure-results';
|
||||
return getAllureConfig($outputDirectory);
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Magento\Framework\Code\Generator\Io;
|
||||
use Magento\Framework\Filesystem\Driver\File;
|
||||
use Magento\Framework\TestFramework\Unit\Autoloader\ExtensionAttributesGenerator;
|
||||
use Magento\Framework\TestFramework\Unit\Autoloader\ExtensionAttributesInterfaceGenerator;
|
||||
use Magento\Framework\TestFramework\Unit\Autoloader\FactoryGenerator;
|
||||
use Magento\Framework\TestFramework\Unit\Autoloader\GeneratedClassesAutoloader;
|
||||
|
||||
$generatorIo = new Io(
|
||||
new File(),
|
||||
TESTS_TEMP_DIR . '/' . DirectoryList::getDefaultConfig()[DirectoryList::GENERATED_CODE][DirectoryList::PATH]
|
||||
);
|
||||
$generatedCodeAutoloader = new GeneratedClassesAutoloader(
|
||||
[
|
||||
new ExtensionAttributesGenerator(),
|
||||
new ExtensionAttributesInterfaceGenerator(),
|
||||
new FactoryGenerator(),
|
||||
],
|
||||
$generatorIo
|
||||
);
|
||||
spl_autoload_register([$generatedCodeAutoloader, 'load']);
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../../../app/autoload.php';
|
||||
|
||||
if (!defined('TESTS_TEMP_DIR')) {
|
||||
define('TESTS_TEMP_DIR', dirname(__DIR__) . '/tmp');
|
||||
}
|
||||
|
||||
// PHP 8 compatibility. Define constants that are not present in PHP < 8.0
|
||||
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80000) {
|
||||
if (!defined('T_NAME_QUALIFIED')) {
|
||||
define('T_NAME_QUALIFIED', 24001);
|
||||
}
|
||||
if (!defined('T_NAME_FULLY_QUALIFIED')) {
|
||||
define('T_NAME_FULLY_QUALIFIED', 24002);
|
||||
}
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/autoload.php';
|
||||
|
||||
setCustomErrorHandler();
|
||||
|
||||
\Magento\Framework\Phrase::setRenderer(new \Magento\Framework\Phrase\Renderer\Placeholder());
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
/* For data consistency between displaying (printing) and serialization a float number */
|
||||
ini_set('precision', 14);
|
||||
ini_set('serialize_precision', 14);
|
||||
|
||||
/**
|
||||
* Set custom error handler
|
||||
*/
|
||||
function setCustomErrorHandler()
|
||||
{
|
||||
set_error_handler(
|
||||
function ($errNo, $errStr, $errFile, $errLine) {
|
||||
$errLevel = error_reporting();
|
||||
if (($errLevel & $errNo) !== 0) {
|
||||
$errorNames = [
|
||||
E_ERROR => 'Error',
|
||||
E_WARNING => 'Warning',
|
||||
E_PARSE => 'Parse',
|
||||
E_NOTICE => 'Notice',
|
||||
E_CORE_ERROR => 'Core Error',
|
||||
E_CORE_WARNING => 'Core Warning',
|
||||
E_COMPILE_ERROR => 'Compile Error',
|
||||
E_COMPILE_WARNING => 'Compile Warning',
|
||||
E_USER_ERROR => 'User Error',
|
||||
E_USER_WARNING => 'User Warning',
|
||||
E_USER_NOTICE => 'User Notice',
|
||||
E_STRICT => 'Strict',
|
||||
E_RECOVERABLE_ERROR => 'Recoverable Error',
|
||||
E_DEPRECATED => 'Deprecated',
|
||||
E_USER_DEPRECATED => 'User Deprecated',
|
||||
];
|
||||
|
||||
$errName = isset($errorNames[$errNo]) ? $errorNames[$errNo] : "";
|
||||
|
||||
throw new \PHPUnit\Framework\Exception(
|
||||
sprintf("%s: %s in %s:%s.", $errName, $errStr, $errFile, $errLine),
|
||||
$errNo
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
||||
colors="true"
|
||||
columns="max"
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
bootstrap="./framework/bootstrap.php">
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".php">../../../app/code/*</directory>
|
||||
<directory suffix=".php">../../../lib/internal/Magento</directory>
|
||||
<directory suffix=".php">../../../setup/src/*</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory>../../../app/code/*/*/Test</directory>
|
||||
<directory>../../../lib/internal/*/*/Test</directory>
|
||||
<directory>../../../lib/internal/*/*/*/Test</directory>
|
||||
<directory>../../../setup/src/*/*/Test</directory>
|
||||
</exclude>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Magento_Unit_Tests_App_Code">
|
||||
<directory>../../../app/code/*/*/Test/Unit</directory>
|
||||
<directory>../../../vendor/magento/module-*/Test/Unit</directory>
|
||||
<exclude>../../../app/code/Magento/Indexer/Test/Unit</exclude>
|
||||
</testsuite>
|
||||
<testsuite name="Magento_Unit_Tests_App_Code_Indexer">
|
||||
<directory>../../../app/code/*/Indexer/Test/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Magento_Unit_Tests_Other">
|
||||
<directory>../../../lib/internal/*/*/Test/Unit</directory>
|
||||
<directory>../../../lib/internal/*/*/*/Test/Unit</directory>
|
||||
<directory>../../../setup/src/*/*/Test/Unit</directory>
|
||||
<directory>../../../vendor/*/module-*/Test/Unit</directory>
|
||||
<directory>../../../vendor/*/framework/Test/Unit</directory>
|
||||
<directory>../../../vendor/*/framework/*/Test/Unit</directory>
|
||||
<directory>../../tests/unit/*/Test/Unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<includePath>.</includePath>
|
||||
<ini name="memory_limit" value="-1"/>
|
||||
<ini name="date.timezone" value="America/Los_Angeles"/>
|
||||
<ini name="xdebug.max_nesting_level" value="200"/>
|
||||
</php>
|
||||
<listeners>
|
||||
<listener class="Magento\Framework\TestFramework\Unit\Listener\ReplaceObjectManager"/>
|
||||
</listeners>
|
||||
<extensions>
|
||||
<extension class="Qameta\Allure\PHPUnit\AllureExtension">
|
||||
<!-- Optional arguments block; omit it if you want to use default values -->
|
||||
<arguments>
|
||||
<!-- Path to config file (default is config/allure.config.php) -->
|
||||
<directory>allure/allure.config.php</directory>
|
||||
</arguments>
|
||||
</extension>
|
||||
</extensions>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,2 @@
|
||||
/*
|
||||
!/.gitignore
|
||||
Reference in New Issue
Block a user