[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 abda73b8e3
commit fbea08ca9b
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
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));
}
}