fix tests

This commit is contained in:
Dennis Eichhorn 2024-03-20 03:00:23 +00:00
parent bff698ca3f
commit b129d5718b
5 changed files with 60 additions and 6 deletions

53
Config/rectortmp.php Normal file
View File

@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector;
use Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector;
use Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector;
use Rector\CodeQuality\Rector\Switch_\SingularSwitchToIfRector;
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
// use Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
PHPUnitSetList::PHPUNIT_100,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
$rectorConfig->paths([
__DIR__ . '/../../tests',
__DIR__ . '/../../Modules/**/tests',
__DIR__ . '/../../phpOMS/tests',
]);
$rectorConfig->skip([
__DIR__ . '/../../vendor',
'*/vendor',
'*/node_modules',
__DIR__ . '/../../privateSetup',
__DIR__ . '/../../demoSetup',
__DIR__ . '/../../Build',
__DIR__ . '/../../MainRepository',
__DIR__ . '/../../Resources',
__DIR__ . '/../../Tools',
__DIR__ . '/../../Sandbox',
__DIR__ . '/../../cssOMS',
'*/Admin/Install/Application',
]);
};

View File

@ -79,7 +79,7 @@ foreach ($modules as $module) {
. 'final class Null' . $model . 'Test extends \PHPUnit\Framework\TestCase' . "\n" . 'final class Null' . $model . 'Test extends \PHPUnit\Framework\TestCase' . "\n"
. '{' . "\n" . '{' . "\n"
. ' /**' . "\n" . ' /**' . "\n"
. ' * @covers Modules\\' . $module . '\Models\Null' . $model . '' . "\n" . ' * @covers \Modules\\' . $module . '\Models\Null' . $model . '' . "\n"
. ' * @group module' . "\n" . ' * @group module' . "\n"
. ' */' . "\n" . ' */' . "\n"
. ' public function testNull() : void' . "\n" . ' public function testNull() : void' . "\n"
@ -88,7 +88,7 @@ foreach ($modules as $module) {
. ' }' . "\n" . ' }' . "\n"
. "\n" . "\n"
. ' /**' . "\n" . ' /**' . "\n"
. ' * @covers Modules\\' . $module . '\Models\Null' . $model . '' . "\n" . ' * @covers \Modules\\' . $module . '\Models\Null' . $model . '' . "\n"
. ' * @group module' . "\n" . ' * @group module' . "\n"
. ' */' . "\n" . ' */' . "\n"
. ' public function testId() : void' . "\n" . ' public function testId() : void' . "\n"
@ -98,7 +98,7 @@ foreach ($modules as $module) {
. ' }' . "\n" . ' }' . "\n"
. "\n" . "\n"
. ' /**' . "\n" . ' /**' . "\n"
. ' * @covers Modules\\' . $module . '\Models\Null' . $model . '' . "\n" . ' * @covers \Modules\\' . $module . '\Models\Null' . $model . '' . "\n"
. ' * @group module' . "\n" . ' * @group module' . "\n"
. ' */' . "\n" . ' */' . "\n"
. ' public function testJsonSerialize() : void' . "\n" . ' public function testJsonSerialize() : void' . "\n"

View File

@ -51,4 +51,4 @@ echo "#################################################"
echo "# PHP stats inspection" echo "# PHP stats inspection"
echo "#################################################" echo "#################################################"
./vendor/bin/phploc --exclude vendor --exclude node_modules --exclude Resources --exclude Build --exclude .git --exclude privateSetup --exclude demoSetup ./ #./vendor/bin/phploc --exclude vendor --exclude node_modules --exclude Resources --exclude Build --exclude .git --exclude privateSetup --exclude demoSetup ./

View File

@ -8,6 +8,7 @@
export PROMPT_COMMAND='echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> /var/www/html/backup/bash/$(date "+%d").log' export PROMPT_COMMAND='echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> /var/www/html/backup/bash/$(date "+%d").log'
add-apt-repository ppa:ondrej/php
apt-get update apt-get update
apt-get upgrade apt-get upgrade
apt-get install git snapd ufw software-properties-common composer nodejs npm apt-get install git snapd ufw software-properties-common composer nodejs npm
@ -37,7 +38,7 @@ service fail2ban restart
## Web ## Web
############################################################### ###############################################################
apt-get install php8.1 php8.1-dev php8.1-cli php8.1-common php8.1-mysql php8.1-pgsql php8.1-xdebug php8.1-opcache php8.1-pdo php8.1-sqlite php8.1-mbstring php8.1-curl php8.1-imap php8.1-bcmath php8.1-zip php8.1-dom php8.1-xml php8.1-phar php8.1-gd php-pear apache2 libapache2-mpm-itk apache2-utils mariadb-server mariadb-client wkhtmltopdf tesseract-ocr poppler-utils imagemagick apt-get install php8.2 php8.2-dev php8.2-cli php8.2-common php8.2-intl php8.2-mysql php8.2-pgsql php8.2-xdebug php8.2-opcache php8.2-pdo php8.2-sqlite php8.2-mbstring php8.2-curl php8.2-imap php8.2-bcmath php8.2-zip php8.2-dom php8.2-xml php8.2-phar php8.2-gd php-pear apache2 libapache2-mpm-itk apache2-utils mariadb-server mariadb-client wkhtmltopdf tesseract-ocr poppler-utils imagemagick
pecl install pcov pecl install pcov
#echo "extension=pcov.so" > /etc/php/cli/conf.d/20-xdebug.ini #echo "extension=pcov.so" > /etc/php/cli/conf.d/20-xdebug.ini

View File

@ -7,5 +7,5 @@ echo "Start php stats inspection"
echo "#################################################" echo "#################################################"
# #
php ${TOOLS_PATH}/vendor/bin/phploc ${INSPECTION_PATH} > ${OUTPUT_PATH}/phploc.log || true #php ${TOOLS_PATH}/vendor/bin/phploc ${INSPECTION_PATH} > ${OUTPUT_PATH}/phploc.log || true
php ${TOOLS_PATH}/vendor/bin/phpmetrics --config=${BUILD_PATH}/Config/phpmetrics.json --junit=${OUTPUT_PATH}/junit_php.xml --report-html=${OUTPUT_PATH}/metrics ${INSPECTION_PATH} || true php ${TOOLS_PATH}/vendor/bin/phpmetrics --config=${BUILD_PATH}/Config/phpmetrics.json --junit=${OUTPUT_PATH}/junit_php.xml --report-html=${OUTPUT_PATH}/metrics ${INSPECTION_PATH} || true