Skip to content
Permalink
Browse files

Infection tests - expect MSI 100% (#189)

  • Loading branch information
kubawerlos committed Nov 15, 2019
1 parent 26bf4ce commit e8622fb610231e270d0e790ef40397a8178eb42a
@@ -40,7 +40,7 @@
"./dev-tools/readme > README.md"
],
"infection": [
"./dev-tools/vendor/bin/infection run --ansi --threads=16"
"./dev-tools/vendor/bin/infection run --ansi --min-msi=100 --only-covered --threads=16"
],
"test": [
"./dev-tools/vendor/bin/phpunit"
@@ -94,7 +94,7 @@ public function getConfigurationDefinition(): FixerConfigurationResolver

public function configure(?array $configuration = null): void
{
$this->allowLinebreak = (bool) ($configuration['allow_linebreak'] ?? $this->allowLinebreak);
$this->allowLinebreak = isset($configuration['allow_linebreak']) && $configuration['allow_linebreak'] === true;
}

public function getPriority(): int
@@ -173,23 +173,21 @@ public function provideFixCases(): iterable

yield [
'<?php
// with invisible character at the end' . \chr(226) . \chr(128) . \chr(168) . '
/* Foo */
/*
* Foo
*/
/* Bar */
/*
* Foo
* Baz
*/
',
'<?php
// with invisible character at the end' . \chr(226) . \chr(128) . \chr(168) . '
/* Foo */
/*
* Foo
*/
/* Foo
*/
/* Bar */
/*
* Baz
*/
',
];
}
@@ -75,14 +75,14 @@ function bar() : ?bool {};

yield [
'<?php
$foo = $a ? bool : bar;
function foo() : ?int {};
function bar() : bool {};
function foo() : bool {};
function bar() : ?int {};
$result = foo() ? bool : bar();
',
'<?php
$foo = $a ? bool : bar;
function foo() : ?int {};
function bar() : ?bool {};
function foo() : ?bool {};
function bar() : ?int {};
$result = foo() ? bool : bar();
',
];
}
@@ -58,18 +58,20 @@ public function provideFixCases(): iterable

yield [
'<?php
// Author: John Doe
namespace Foo;
/** class Bar */
class Bar {}
',
'<?php
// Author: John Doe
/**
* Created by PhpStorm.
* User: root
* Date: 01.01.70
* Time: 12:34
*/
namespace Foo;
/** class Bar */
class Bar {}
',
];

@@ -361,20 +361,22 @@ public function baz() {}

yield [
'<?php
// Useless comment
foo();
// @author: John Doe
class Bar {}
//
class Baz {}
class Foo {
public function calculation() {
// @author: John Doe
return 42;
}
}
',
'<?php
// Useless comment
foo();
// @author: John Doe
class Bar {}
// Class Baz
class Baz {}
// Class Foo
class Foo {
public function calculation() {
// @author: John Doe
return 42;
}
}
',
];
}
@@ -54,24 +54,24 @@ class FooRepository extends EntityRepository {}

yield [
'<?php
/**
* FooRepository
*/
class FooRepository extends EntityRepository {}
class FooRepository extends EntityRepository {
/**
* @return array
*/
public function foo() {}
}
',
'<?php
/**
* FooRepository
*/
/**
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
/**
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class FooRepository extends EntityRepository {}
class FooRepository extends EntityRepository {
/**
* @return array
*/
public function foo() {}
}
',
];
}
@@ -78,16 +78,16 @@ public function provideFixCases(): iterable

yield [
'<?php
PrintingHelper::sprintf("Message");
$foo = sprintf("Hello, %s!", "Foo");
$bar = "Bar";
$foo = "Foo";
PrintingHelper::sprintf("Bar");
$baz = "Baz";
PrintingHelper::sprintf("Qux");
',
'<?php
PrintingHelper::sprintf("Message");
$foo = sprintf("Hello, %s!", "Foo");
$bar = sprintf("Bar");
$foo = sprintf("Foo");
PrintingHelper::sprintf("Bar");
$baz = sprintf("Baz");
PrintingHelper::sprintf("Qux");
',
];
}
@@ -298,20 +298,23 @@ class Foo
/** Class Foo */
class Foo
{
private $a;
public function hello()
{
$b = [1, 2, 3];
foreach ($b as $x) {}
}
private $b;
}
',
'<?php
/** Class Foo */
class Foo
{
/** @var $b */
private $a;
public function hello()
{
/** @var $a */
@@ -320,9 +323,6 @@ public function hello()
/** @var $y */
foreach ($b as $x) {}
}
/** @var */
private $b;
}
',
];
@@ -121,26 +121,26 @@ public function provideFixCases(): iterable

yield [
'<?php
/** first comment */
/**
* @param bool $a
* @param mixed $a
*/
function foo($a) {}
/**
* @param mixed $a
* @param bool $a
*/
function bar($a) {}
/** comment */
',
'<?php
/** first comment */
/**
* @param bool $a
* @param $a
*/
function foo($a) {}
/**
* @param $a
* @param bool $a
*/
function bar($a) {}
/** comment */
',
];
}
@@ -172,24 +172,26 @@ public function provideFixCases(): iterable

yield [
'<?php
/** first comment */
/** comment */
/** @var ChangedOne */
/** @var AlreadyGood $baz */
/**
* @var Foo $foo
* @var Bar $bar
*/
/** @var Baz $baz */
/** @var HelloWorld */
/** another comment */
',
'<?php
/** first comment */
/** comment */
/**
* @var Foo $foo
* @var Bar $bar
* @var ChangedOne
*/
/** @var Baz $baz */
/** @var AlreadyGood $baz */
/**
* @var HelloWorld
* @var Foo $foo
* @var Bar $bar
*/
/** another comment */
',
];
}
@@ -241,20 +241,16 @@ public function provideFixCases(): iterable

yield [
'<?php
$a = new class() {};
continue;
foo();
break
;
class Baz {}
class Foo {}
$a = new Foo();
$b = new
Foo();
',
'<?php
$a = new class() {};
continue;
foo();
break
;
class Baz {}
class Foo {}
$a = new Foo();
$b = new
Foo();
',
['allow_linebreak' => true],
];

0 comments on commit e8622fb

Please sign in to comment.
You can’t perform that action at this time.