[TESTS] Raise App\Util\Bitmap test coverage to 100%

This commit is contained in:
Hugo Sales 2021-05-02 20:47:15 +00:00
parent f841e5e0dd
commit fde7b87c65
2 changed files with 15 additions and 0 deletions

View File

@ -19,6 +19,7 @@
namespace App\Util;
use App\Core\Log;
use App\Util\Exception\ServerException;
abstract class Bitmap

View File

@ -19,6 +19,8 @@
namespace App\Tests\Util;
use App\Util\Exception\ServerException;
use Jchook\AssertThrows\AssertThrows;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class FooBitmap extends \App\Util\Bitmap
@ -35,8 +37,15 @@ class BarBitmap extends \App\Util\Bitmap
public const PREFIX = 'BAR_';
}
class QuuxBitmap extends \App\Util\Bitmap
{
public const HELIUM = 2;
}
class BitmapTest extends KernelTestCase
{
use AssertThrows;
public function testObj()
{
$a = FooBitmap::create(FooBitmap::FOO | FooBitmap::BAR);
@ -56,4 +65,9 @@ class BitmapTest extends KernelTestCase
$b = BarBitmap::toArray(BarBitmap::HYDROGEN | BarBitmap::HELIUM);
static::assertSame(['BAR_HYDROGEN', 'BAR_HELIUM'], $b);
}
public function testThrows()
{
static::assertThrows(ServerException::class, fn () => QuuxBitmap::create(1));
}
}