20250203
This commit is contained in:
30
tests/classes/ClassMapperTest.php
Normal file
30
tests/classes/ClassMapperTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace goodboyalex\php_components_pack\tests\classes;
|
||||
|
||||
use goodboyalex\php_components_pack\classes\ClassMapper;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClassMapperTest extends TestCase
|
||||
{
|
||||
public function testMapClass ()
|
||||
{
|
||||
$this->PrepareForTest();
|
||||
|
||||
$a = new \goodboyalex\php_components_pack\tests\data\A();
|
||||
$a->a = 'a';
|
||||
$a->b = 2;
|
||||
$a->c = true;
|
||||
|
||||
$b = new B();
|
||||
ClassMapper::MapClass($a, $b);
|
||||
|
||||
$this->assertEquals('a', $b->a);
|
||||
$this->assertEquals(2, $b->b);
|
||||
}
|
||||
|
||||
private function PrepareForTest (): void
|
||||
{
|
||||
require_once __DIR__ . '/../../sources/classes/classMapper.php';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user