Increase code coverage

This commit is contained in:
Timothy Warren 2020-03-12 12:04:20 -04:00
parent 986ff6de0b
commit 055ec80236
3 changed files with 14 additions and 8 deletions

View File

@ -17,6 +17,8 @@
namespace Aviat\AnimeClient;
use Aviat\AnimeClient\Types\Config as ConfigType;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
use function Aviat\Ion\_dir;
@ -34,8 +36,8 @@ require_once __DIR__ . '/vendor/autoload.php';
// if (array_key_exists('ENV', $_ENV) && $_ENV['ENV'] === 'development')
{
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops = new Run;
$whoops->pushHandler(new PrettyPageHandler);
$whoops->register();
}

View File

@ -146,10 +146,12 @@ class Friend {
}
// Return NULL on any exception, so no further logic needed
// in the catch block
// @codeCoverageIgnoreStart
catch (\Exception $e)
{
return NULL;
}
// @codeCoverageIgnoreEnd
}
}
// End of Friend.php

View File

@ -21,25 +21,27 @@ use Aviat\Ion\Tests\FriendTestClass;
class FriendTest extends IonTestCase {
protected $friend;
public function setUp(): void {
parent::setUp();
$obj = new FriendTestClass();
$this->friend = new Friend($obj);
}
public function testPrivateMethod()
public function testPrivateMethod():void
{
$actual = $this->friend->getPrivate();
$this->assertEquals(23, $actual);
}
public function testProtectedMethod()
public function testProtectedMethod():void
{
$actual = $this->friend->getProtected();
$this->assertEquals(4, $actual);
}
public function testGet()
public function testGet():void
{
$this->assertEquals(356, $this->friend->protected);
$this->assertNull($this->friend->foo); // Return NULL for non-existent properties
@ -48,7 +50,7 @@ class FriendTest extends IonTestCase {
$this->assertNull($this->friend->parentPrivate); // Can't get a parent's privates
}
public function testSet()
public function testSet(): void
{
$this->friend->private = 123;
$this->assertEquals(123, $this->friend->private);
@ -57,7 +59,7 @@ class FriendTest extends IonTestCase {
$this->assertNull($this->friend->foo);
}
public function testBadInvokation()
public function testBadInvokation():void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Friend must be an object');
@ -65,7 +67,7 @@ class FriendTest extends IonTestCase {
$friend = new Friend('foo');
}
public function testBadMethod()
public function testBadMethod():void
{
$this->expectException('BadMethodCallException');
$this->expectExceptionMessage("Method 'foo' does not exist");