This commit is contained in:
Daniil Gentili 2023-10-23 22:21:50 +02:00
parent b3fc233d62
commit 021d21d782
3 changed files with 138 additions and 0 deletions

80
bugs/1_infection.php Normal file
View File

@ -0,0 +1,80 @@
<?php
require 'vendor/autoload.php';
use Infection\Configuration\Entry\Logs;
use Infection\Configuration\Entry\PhpUnit;
use Infection\Configuration\Entry\Source;
use Infection\Configuration\Schema\SchemaConfiguration;
use Infection\Configuration\Schema\SchemaConfigurationFactory;
use JsonSchema\Validator;
function test_it_can_create_a_config(
string $json,
): void {
$rawConfig = json_decode($json);
$validator = new Validator();
$validator->validate($rawConfig, json_decode('{
"$schema": "https://json-schema.org/draft-07/schema#",
"properties": {
"source": {"type": "string"}
}
}'));
$actual = (new SchemaConfigurationFactory())->create(
'/path/to/config',
$rawConfig
);
}
function provideRawConfig(): iterable
{
yield '[timeout] nominal' => [
<<<'JSON'
{
"timeout": 100,
"source": {
"directories": ["src"]
}
}
JSON
,
];
yield '[logs][text] nominal' => [
<<<'JSON'
{
"source": {
"directories": ["src"]
},
"logs": {
"text": "text.log"
}
}
JSON
,
];
yield '[logs][html] nominal' => [
<<<'JSON'
{
"source": {
"directories": ["src"]
},
"logs": {
"html": "report.html"
}
}
JSON
,
];
}
for ($x = 0; $x < 10000; $x++) {
foreach (provideRawConfig() as [$a]) {
test_it_can_create_a_config($a);
}
}

33
bugs/1_infection.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash -e
#!/bin/bash -e
standalone=$PWD/bugs/1_infection.php
cd /tmp
rm -rf infection
git clone https://github.com/infection/infection
cd infection
git checkout fe7cbe78e5838608df42ec7688d353ef1d631fee
composer i --ignore-platform-reqs
cp $standalone .
echo "About to run the standalone test"
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/2_infection.php
echo "About to run the testsuite"
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php vendor/bin/phpunit
echo "About to run composer"
rm -rf vendor
docker run -v $PWD:/app --rm --privileged -it asan_tests composer update
echo "OK, no bugs!"

25
bugs/2_psalm.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash -e
cd /tmp
rm -rf psalm
git clone https://github.com/vimeo/psalm
cd psalm
git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457
export PSALM_ALLOW_XDEBUG=1
composer i --ignore-platform-reqs
echo "About to run phpunit"
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/vendor/bin/phpunit --debug tests/MagicMethodAnnotationTest.php
echo "About to run composer"
rm -rf vendor
docker run -v $PWD:/app --rm --privileged -it asan_tests composer update
echo "OK, no bugs!"