Remove composer install phan/phpstan/etc and switch to phive install
This commit is contained in:
8
.phive/phars.xml
Normal file
8
.phive/phars.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phive xmlns="https://phar.io/phive">
|
||||||
|
<phar name="phpunit" version="^10.3.5" installed="10.3.5" location="./tools/phpunit" copy="false"/>
|
||||||
|
<phar name="phpcs" version="^3.7.2" installed="3.7.2" location="./tools/phpcs" copy="false"/>
|
||||||
|
<phar name="phpcbf" version="^3.7.2" installed="3.7.2" location="./tools/phpcbf" copy="false"/>
|
||||||
|
<phar name="psalm" version="^5.15.0" installed="5.15.0" location="./tools/psalm" copy="false"/>
|
||||||
|
<phar name="phpstan" version="^1.10.37" installed="1.10.37" location="./tools/phpstan" copy="false"/>
|
||||||
|
</phive>
|
||||||
18
ReadMe.md
18
ReadMe.md
@@ -23,3 +23,21 @@ Alternative setup composer local zip file repot:
|
|||||||
## Install package
|
## Install package
|
||||||
|
|
||||||
`composer require egrajp/corelibs-composer-all:^8.0`
|
`composer require egrajp/corelibs-composer-all:^8.0`
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
All tests must be run from the base folder
|
||||||
|
|
||||||
|
### phan
|
||||||
|
|
||||||
|
`phan --progress-bar -C --analyze-twic`
|
||||||
|
|
||||||
|
### phpstan
|
||||||
|
|
||||||
|
`phpstan`
|
||||||
|
|
||||||
|
### phpunit
|
||||||
|
|
||||||
|
PHP unit is installed via "phiev"
|
||||||
|
|
||||||
|
`tools/phpunit test/phpunit`
|
||||||
|
|||||||
@@ -20,11 +20,7 @@
|
|||||||
"psr/log": "^3.0@dev"
|
"psr/log": "^3.0@dev"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "^1.10",
|
|
||||||
"phan/phan": "v5.x-dev",
|
|
||||||
"phpunit/phpunit": "^9",
|
|
||||||
"egrajp/smarty-extended": "^4.3",
|
"egrajp/smarty-extended": "^4.3",
|
||||||
"vimeo/psalm": "^5.0@dev",
|
|
||||||
"gullevek/dotenv": "dev-master"
|
"gullevek/dotenv": "dev-master"
|
||||||
},
|
},
|
||||||
"repositories": {
|
"repositories": {
|
||||||
|
|||||||
@@ -2,5 +2,6 @@
|
|||||||
cacheResultFile="/tmp/phpunit-corelibs-composer.result.cache"
|
cacheResultFile="/tmp/phpunit-corelibs-composer.result.cache"
|
||||||
colors="true"
|
colors="true"
|
||||||
verbose="true"
|
verbose="true"
|
||||||
|
bootstrap="test/phpunit/bootstrap.php"
|
||||||
>
|
>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
@@ -3907,7 +3907,8 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
'id' => '51',
|
'id' => '51',
|
||||||
'error' => 'Max query call needs to be set to at least 1',
|
'error' => 'Max query call needs to be set to at least 1',
|
||||||
// run:: can be +1 if called in set and not direct
|
// run:: can be +1 if called in set and not direct
|
||||||
'source' => "/^include::main::run::run::run::run::run::run::(run::)?runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall$/",
|
// 'main::run::run::run::run::run::run::run::runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall
|
||||||
|
'source' => "/^(include::)?main::(run::)+runBare::runTest::testDbErrorHandling::dbSetMaxQueryCall$/",
|
||||||
'pg_error' => '',
|
'pg_error' => '',
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -460,8 +460,8 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
* @cover ::getCallerFileLine
|
* @cover ::getCallerFileLine
|
||||||
* @testWith ["vendor/phpunit/phpunit/src/Framework/TestCase.php:"]
|
* @testWith ["vendor/phpunit/phpunit/src/Framework/TestCase.php:6434","phar:///home/clemens/.phive/phars/phpunit-9.6.13.phar/phpunit/Framework/TestCase.php:6434"]
|
||||||
* @testdox getCallerFileLine check based on regex /[\w\-\/]/vendor/phpunit/phpunit/src/Framework/TestCase.php:\d+ [$_dataName]
|
* @testdox getCallerFileLine check based on regex .../Framework/TestCase.php:\d+ [$_dataName]
|
||||||
*
|
*
|
||||||
* @param string $expected
|
* @param string $expected
|
||||||
* @return void
|
* @return void
|
||||||
@@ -469,7 +469,14 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
public function testGetCallerFileLine(): void
|
public function testGetCallerFileLine(): void
|
||||||
{
|
{
|
||||||
// regex prefix with path "/../" and then fixed vendor + \d+
|
// regex prefix with path "/../" and then fixed vendor + \d+
|
||||||
$regex = "/^\/[\w\-\/]+\/vendor\/phpunit\/phpunit\/src\/Framework\/TestCase.php:\d+$/";
|
// or phar start if phiev installed
|
||||||
|
// phar:///home/clemens/.phive/phars/phpunit-9.6.13.phar/phpunit/Framework/TestCase.php
|
||||||
|
$regex = "/^("
|
||||||
|
. "\/.*\/vendor\/phpunit\/phpunit\/src"
|
||||||
|
. "|"
|
||||||
|
. "phar:\/\/\/.*\.phive\/phars\/phpunit-\d+\.\d+\.\d+\.phar\/phpunit"
|
||||||
|
. ")"
|
||||||
|
. "\/Framework\/TestCase.php:\d+$/";
|
||||||
$this->assertMatchesRegularExpression(
|
$this->assertMatchesRegularExpression(
|
||||||
$regex,
|
$regex,
|
||||||
Support::getCallerFileLine()
|
Support::getCallerFileLine()
|
||||||
@@ -514,27 +521,30 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
// add nothing
|
// add nothing
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
Support::getCallerMethodList(),
|
$compare,
|
||||||
'assert expected 10'
|
'assert expected 10'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
// add one "run" before "runBare"
|
if ($compare[0] == 'include') {
|
||||||
// array_splice(
|
// add include at first
|
||||||
// $expected,
|
array_splice(
|
||||||
// 7,
|
$expected,
|
||||||
// 0,
|
0,
|
||||||
// ['run']
|
0,
|
||||||
// );
|
['include']
|
||||||
array_splice(
|
);
|
||||||
$expected,
|
} else {
|
||||||
0,
|
array_splice(
|
||||||
0,
|
$expected,
|
||||||
['include']
|
6,
|
||||||
);
|
0,
|
||||||
|
['run']
|
||||||
|
);
|
||||||
|
}
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
Support::getCallerMethodList(),
|
$compare,
|
||||||
'assert expected 11'
|
'assert expected 11'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -554,7 +564,7 @@ final class CoreLibsDebugSupportTest extends TestCase
|
|||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$expected,
|
$expected,
|
||||||
Support::getCallerMethodList(),
|
$compare,
|
||||||
'assert expected 12'
|
'assert expected 12'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ final class CoreLibsGetSystemTest extends TestCase
|
|||||||
1 => 'phpunit',
|
1 => 'phpunit',
|
||||||
2 => 'phpunit',
|
2 => 'phpunit',
|
||||||
// NOTE: this can change, so it is a regex check
|
// NOTE: this can change, so it is a regex check
|
||||||
3 => "/^(\/?.*\/?)?vendor\/bin\/phpunit$/",
|
3 => "/^(\/?.*\/?)?(vendor\/bin|tools)\/phpunit$/",
|
||||||
],
|
],
|
||||||
'some path with extension' => [
|
'some path with extension' => [
|
||||||
0 => '/some/path/to/file.txt',
|
0 => '/some/path/to/file.txt',
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ final class CoreLibsLoggingLoggingTest extends TestCase
|
|||||||
private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR;
|
private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR;
|
||||||
private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date
|
private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date
|
||||||
. "\[[\w\.]+(:\d+)?\]\s{1}" // host:port
|
. "\[[\w\.]+(:\d+)?\]\s{1}" // host:port
|
||||||
. "\[[\w\-\.\/]+:\d+\]\s{1}" // folder/file
|
. "\[(phar:\/\/)?[\w\-\.\/]+:\d+\]\s{1}" // folder/file [note phar:// is for phpunit]
|
||||||
. "\[\w+\]\s{1}" // run id
|
. "\[\w+\]\s{1}" // run id
|
||||||
. "{[\w\\\\]+((::|->)\w+)?}\s{1}"; // class
|
. "{[\w\\\\]+((::|->)\w+)?}\s{1}"; // class
|
||||||
|
|
||||||
|
|||||||
15
test/phpunit/bootstrap.php
Normal file
15
test/phpunit/bootstrap.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$set = 0;
|
||||||
|
foreach (['/../..', '/..', '/../../www', '/../www'] as $src) {
|
||||||
|
if (is_file(dirname(__DIR__) . $src . '/vendor/autoload.php')) {
|
||||||
|
require dirname(__DIR__) . $src . '/vendor/autoload.php';
|
||||||
|
$set = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$set) {
|
||||||
|
die("Cannot find /vendor/autoload.php in reference to: " . dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
// __END__
|
||||||
1
tools/phpcbf
Symbolic link
1
tools/phpcbf
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/clemens/.phive/phars/phpcbf-3.7.2.phar
|
||||||
1
tools/phpcs
Symbolic link
1
tools/phpcs
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/clemens/.phive/phars/phpcs-3.7.2.phar
|
||||||
1
tools/phpstan
Symbolic link
1
tools/phpstan
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/clemens/.phive/phars/phpstan-1.10.37.phar
|
||||||
1
tools/phpunit
Symbolic link
1
tools/phpunit
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/clemens/.phive/phars/phpunit-10.3.5.phar
|
||||||
1
tools/psalm
Symbolic link
1
tools/psalm
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/home/clemens/.phive/phars/psalm-5.15.0.phar
|
||||||
Reference in New Issue
Block a user