From fbea08ca9b5f19a46fb8b1d91b28261dad7c350f Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Sun, 2 May 2021 20:47:15 +0000 Subject: [PATCH] [TESTS] Raise App\Util\Bitmap test coverage to 100% --- src/Util/Bitmap.php | 1 + tests/Util/BitmapTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Util/Bitmap.php b/src/Util/Bitmap.php index 1d5956dde2..ab8c2a3385 100644 --- a/src/Util/Bitmap.php +++ b/src/Util/Bitmap.php @@ -19,6 +19,7 @@ namespace App\Util; +use App\Core\Log; use App\Util\Exception\ServerException; abstract class Bitmap diff --git a/tests/Util/BitmapTest.php b/tests/Util/BitmapTest.php index 2178df2b5d..0ce7e1c8c1 100644 --- a/tests/Util/BitmapTest.php +++ b/tests/Util/BitmapTest.php @@ -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)); + } }