Set up mutation testing for unit tests
This commit is contained in:
parent
e62558d607
commit
47e67d5d1a
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,4 +25,5 @@ app/config/*.toml
|
||||
!app/config/*.toml.example
|
||||
phinx.yml
|
||||
.idea/
|
||||
Caddyfile
|
||||
Caddyfile
|
||||
build/humbuglog.txt
|
@ -28,6 +28,7 @@
|
||||
"phploc/phploc": "^3.0",
|
||||
"phpmd/phpmd": "^2.4",
|
||||
"phpunit/phpunit": "^5.4",
|
||||
"robmorgan/phinx": "^0.6.4"
|
||||
"robmorgan/phinx": "^0.6.4",
|
||||
"humbug/humbug": "~1.0@dev"
|
||||
}
|
||||
}
|
||||
|
12
humbug.json.dist
Normal file
12
humbug.json.dist
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"source": {
|
||||
"directories": [
|
||||
"src"
|
||||
]
|
||||
},
|
||||
"timeout": 10,
|
||||
"logs": {
|
||||
"text": "build\/humbuglog.txt",
|
||||
"json": "build\/humbug.json"
|
||||
}
|
||||
}
|
29
phpunit.xml
Normal file
29
phpunit.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
colors="true"
|
||||
stopOnFailure="false"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
beStrictAboutTestsThatDoNotTestAnything="true"
|
||||
>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">src/Aviat/Ion</directory>
|
||||
<directory suffix=".php">src/Aviat/AnimeClient</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<testsuites>
|
||||
<testsuite name="Ion">
|
||||
<directory>tests/Ion</directory>
|
||||
</testsuite>
|
||||
<testsuite name="AnimeClient">
|
||||
<directory>tests/AnimeClient</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<server name="HTTP_USER_AGENT" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0" />
|
||||
<server name="HTTP_HOST" value="localhost" />
|
||||
<server name="SERVER_NAME" value="localhost" />
|
||||
<server name="REQUEST_URI" value="/" />
|
||||
<server name="REQUEST_METHOD" value="GET" />
|
||||
</php>
|
||||
</phpunit>
|
@ -23,7 +23,8 @@ class ConfigTest extends AnimeClient_TestCase {
|
||||
|
||||
public function testConfigSet()
|
||||
{
|
||||
$this->config->set('foo', 'foobar');
|
||||
$ret = $this->config->set('foo', 'foobar');
|
||||
$this->assertInstanceOf('Aviat\Ion\Config', $ret);
|
||||
$this->assertEquals('foobar', $this->config->get('foo'));
|
||||
|
||||
$this->config->set(['apple', 'sauce', 'is'], 'great');
|
||||
@ -31,6 +32,7 @@ class ConfigTest extends AnimeClient_TestCase {
|
||||
$this->assertEquals('great', $apple['sauce']['is'], "Config value not set correctly");
|
||||
|
||||
$this->assertEquals('great', $this->config->get(['apple', 'sauce', 'is']), "Array argument get for config failed.");
|
||||
|
||||
}
|
||||
|
||||
public function testConfigBadSet()
|
||||
|
@ -51,6 +51,15 @@ class ContainerTest extends AnimeClient_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetSet()
|
||||
{
|
||||
$container = $this->container->set('foo', function() {});
|
||||
|
||||
$this->assertInstanceOf('Aviat\Ion\Di\Container', $container);
|
||||
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $container);
|
||||
$this->assertTrue(is_callable($container->get('foo')));
|
||||
}
|
||||
|
||||
public function testLoggerMethods()
|
||||
{
|
||||
// Does the container have the default logger?
|
||||
@ -63,8 +72,11 @@ class ContainerTest extends AnimeClient_TestCase {
|
||||
$logger2->pushHandler(new TestHandler());
|
||||
|
||||
// Set the logger channels
|
||||
$this->container->setLogger($logger1);
|
||||
$this->container->setLogger($logger2, 'test');
|
||||
$container = $this->container->setLogger($logger1);
|
||||
$container2 = $this->container->setLogger($logger2, 'test');
|
||||
|
||||
$this->assertInstanceOf('Aviat\Ion\Di\ContainerInterface', $container);
|
||||
$this->assertInstanceOf('Aviat\Ion\Di\Container', $container2);
|
||||
|
||||
$this->assertEquals($logger1, $this->container->getLogger('default'));
|
||||
$this->assertEquals($logger2, $this->container->getLogger('test'));
|
||||
|
@ -79,6 +79,15 @@ class ArrayTypeTest extends AnimeClient_TestCase {
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testSet()
|
||||
{
|
||||
$obj = $this->arr([]);
|
||||
$arraytype = $obj->set('foo', 'bar');
|
||||
|
||||
$this->assertInstanceOf('Aviat\Ion\Type\ArrayType', $arraytype);
|
||||
$this->assertEquals('bar', $obj->get('foo'));
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$array = [1, 2, 3, 4, 5];
|
||||
|
Loading…
Reference in New Issue
Block a user