[TESTS] Raise App\Util\Bitmap test coverage to 100%
This commit is contained in:
parent
abda73b8e3
commit
fbea08ca9b
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
namespace App\Util;
|
namespace App\Util;
|
||||||
|
|
||||||
|
use App\Core\Log;
|
||||||
use App\Util\Exception\ServerException;
|
use App\Util\Exception\ServerException;
|
||||||
|
|
||||||
abstract class Bitmap
|
abstract class Bitmap
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
namespace App\Tests\Util;
|
namespace App\Tests\Util;
|
||||||
|
|
||||||
|
use App\Util\Exception\ServerException;
|
||||||
|
use Jchook\AssertThrows\AssertThrows;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class FooBitmap extends \App\Util\Bitmap
|
class FooBitmap extends \App\Util\Bitmap
|
||||||
|
@ -35,8 +37,15 @@ class BarBitmap extends \App\Util\Bitmap
|
||||||
public const PREFIX = 'BAR_';
|
public const PREFIX = 'BAR_';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QuuxBitmap extends \App\Util\Bitmap
|
||||||
|
{
|
||||||
|
public const HELIUM = 2;
|
||||||
|
}
|
||||||
|
|
||||||
class BitmapTest extends KernelTestCase
|
class BitmapTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
use AssertThrows;
|
||||||
|
|
||||||
public function testObj()
|
public function testObj()
|
||||||
{
|
{
|
||||||
$a = FooBitmap::create(FooBitmap::FOO | FooBitmap::BAR);
|
$a = FooBitmap::create(FooBitmap::FOO | FooBitmap::BAR);
|
||||||
|
@ -56,4 +65,9 @@ class BitmapTest extends KernelTestCase
|
||||||
$b = BarBitmap::toArray(BarBitmap::HYDROGEN | BarBitmap::HELIUM);
|
$b = BarBitmap::toArray(BarBitmap::HYDROGEN | BarBitmap::HELIUM);
|
||||||
static::assertSame(['BAR_HYDROGEN', 'BAR_HELIUM'], $b);
|
static::assertSame(['BAR_HYDROGEN', 'BAR_HELIUM'], $b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testThrows()
|
||||||
|
{
|
||||||
|
static::assertThrows(ServerException::class, fn () => QuuxBitmap::create(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user