Increase code coverage
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good
This commit is contained in:
parent
4fd03d309c
commit
bcbb24c0f5
@ -17,6 +17,8 @@
|
|||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\AnimeClient\Types\Config as ConfigType;
|
use Aviat\AnimeClient\Types\Config as ConfigType;
|
||||||
|
use Whoops\Handler\PrettyPageHandler;
|
||||||
|
use Whoops\Run;
|
||||||
|
|
||||||
use function Aviat\Ion\_dir;
|
use function Aviat\Ion\_dir;
|
||||||
|
|
||||||
@ -34,8 +36,8 @@ require_once __DIR__ . '/vendor/autoload.php';
|
|||||||
|
|
||||||
// if (array_key_exists('ENV', $_ENV) && $_ENV['ENV'] === 'development')
|
// if (array_key_exists('ENV', $_ENV) && $_ENV['ENV'] === 'development')
|
||||||
{
|
{
|
||||||
$whoops = new \Whoops\Run;
|
$whoops = new Run;
|
||||||
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
$whoops->pushHandler(new PrettyPageHandler);
|
||||||
$whoops->register();
|
$whoops->register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,10 +146,12 @@ class Friend {
|
|||||||
}
|
}
|
||||||
// Return NULL on any exception, so no further logic needed
|
// Return NULL on any exception, so no further logic needed
|
||||||
// in the catch block
|
// in the catch block
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End of Friend.php
|
// End of Friend.php
|
@ -21,25 +21,27 @@ use Aviat\Ion\Tests\FriendTestClass;
|
|||||||
|
|
||||||
class FriendTest extends IonTestCase {
|
class FriendTest extends IonTestCase {
|
||||||
|
|
||||||
|
protected $friend;
|
||||||
|
|
||||||
public function setUp(): void {
|
public function setUp(): void {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$obj = new FriendTestClass();
|
$obj = new FriendTestClass();
|
||||||
$this->friend = new Friend($obj);
|
$this->friend = new Friend($obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrivateMethod()
|
public function testPrivateMethod():void
|
||||||
{
|
{
|
||||||
$actual = $this->friend->getPrivate();
|
$actual = $this->friend->getPrivate();
|
||||||
$this->assertEquals(23, $actual);
|
$this->assertEquals(23, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProtectedMethod()
|
public function testProtectedMethod():void
|
||||||
{
|
{
|
||||||
$actual = $this->friend->getProtected();
|
$actual = $this->friend->getProtected();
|
||||||
$this->assertEquals(4, $actual);
|
$this->assertEquals(4, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet()
|
public function testGet():void
|
||||||
{
|
{
|
||||||
$this->assertEquals(356, $this->friend->protected);
|
$this->assertEquals(356, $this->friend->protected);
|
||||||
$this->assertNull($this->friend->foo); // Return NULL for non-existent properties
|
$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
|
$this->assertNull($this->friend->parentPrivate); // Can't get a parent's privates
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSet()
|
public function testSet(): void
|
||||||
{
|
{
|
||||||
$this->friend->private = 123;
|
$this->friend->private = 123;
|
||||||
$this->assertEquals(123, $this->friend->private);
|
$this->assertEquals(123, $this->friend->private);
|
||||||
@ -57,7 +59,7 @@ class FriendTest extends IonTestCase {
|
|||||||
$this->assertNull($this->friend->foo);
|
$this->assertNull($this->friend->foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBadInvokation()
|
public function testBadInvokation():void
|
||||||
{
|
{
|
||||||
$this->expectException('InvalidArgumentException');
|
$this->expectException('InvalidArgumentException');
|
||||||
$this->expectExceptionMessage('Friend must be an object');
|
$this->expectExceptionMessage('Friend must be an object');
|
||||||
@ -65,7 +67,7 @@ class FriendTest extends IonTestCase {
|
|||||||
$friend = new Friend('foo');
|
$friend = new Friend('foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBadMethod()
|
public function testBadMethod():void
|
||||||
{
|
{
|
||||||
$this->expectException('BadMethodCallException');
|
$this->expectException('BadMethodCallException');
|
||||||
$this->expectExceptionMessage("Method 'foo' does not exist");
|
$this->expectExceptionMessage("Method 'foo' does not exist");
|
||||||
|
Loading…
Reference in New Issue
Block a user