mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Increase code coverage of the BaseTestCaseTrait
This commit is contained in:
@@ -19,4 +19,8 @@ use Meritoo\Common\Traits\Test\Base\BaseTestCaseTrait;
|
|||||||
class SimpleTestCase
|
class SimpleTestCase
|
||||||
{
|
{
|
||||||
use BaseTestCaseTrait;
|
use BaseTestCaseTrait;
|
||||||
|
|
||||||
|
private function thePrivateMethod(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,13 @@ declare(strict_types=1);
|
|||||||
namespace Meritoo\Test\Common\Traits\Test\Base;
|
namespace Meritoo\Test\Common\Traits\Test\Base;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use Meritoo\Common\Exception\Reflection\ClassWithoutConstructorException;
|
||||||
|
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
|
use Meritoo\Common\Traits\Test\Base\BaseTestCaseTrait;
|
||||||
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
use Meritoo\Test\Common\Traits\Test\Base\BaseTestCaseTrait\SimpleTestCase;
|
use Meritoo\Test\Common\Traits\Test\Base\BaseTestCaseTrait\SimpleTestCase;
|
||||||
|
use ReflectionMethod;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,6 +31,39 @@ use stdClass;
|
|||||||
*/
|
*/
|
||||||
class BaseTestCaseTraitTest extends BaseTestCase
|
class BaseTestCaseTraitTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
use BaseTestCaseTrait;
|
||||||
|
|
||||||
|
public function testAssertMethodVisibility(): void
|
||||||
|
{
|
||||||
|
$method = new ReflectionMethod(SimpleTestCase::class, 'assertMethodVisibility');
|
||||||
|
static::assertMethodVisibility($method, OopVisibilityType::IS_PROTECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAssertMethodVisibilityUsingIncorrectVisibility(): void
|
||||||
|
{
|
||||||
|
$this->expectException(UnknownOopVisibilityTypeException::class);
|
||||||
|
|
||||||
|
$method = new ReflectionMethod(SimpleTestCase::class, 'assertMethodVisibility');
|
||||||
|
static::assertMethodVisibility($method, '4');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAssertMethodVisibilityUsingPrivate(): void
|
||||||
|
{
|
||||||
|
$method = new ReflectionMethod(SimpleTestCase::class, 'thePrivateMethod');
|
||||||
|
static::assertMethodVisibility($method, OopVisibilityType::IS_PRIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAssertConstructorVisibilityAndArgumentsUsingClassWithoutConstructor(): void
|
||||||
|
{
|
||||||
|
$this->expectException(ClassWithoutConstructorException::class);
|
||||||
|
static::assertConstructorVisibilityAndArguments(SimpleTestCase::class, OopVisibilityType::IS_PUBLIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAssertHasNoConstructor(): void
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(SimpleTestCase::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testProvideEmptyValue(): void
|
public function testProvideEmptyValue(): void
|
||||||
{
|
{
|
||||||
$testCase = new SimpleTestCase();
|
$testCase = new SimpleTestCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user