33 lines
		
	
	
		
			858 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			858 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace goodboyalex\php_components_pack\tests\classes;
 | |
| 
 | |
| use goodboyalex\php_components_pack\classes\ClassMapper;
 | |
| use goodboyalex\php_components_pack\tests\data\A;
 | |
| use goodboyalex\php_components_pack\tests\data\B;
 | |
| use PHPUnit\Framework\TestCase;
 | |
| 
 | |
| class ClassMapperTest extends TestCase
 | |
| {
 | |
|     public function testMapClass ()
 | |
|     {
 | |
|         $this->PrepareForTest();
 | |
| 
 | |
|         $a = new A('a', 2, 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__ . '/../data/A.php';
 | |
|         require_once __DIR__ . '/../data/B.php';
 | |
|         require_once __DIR__ . '/../../sources/attributes/GetOnly.php';
 | |
|         require_once __DIR__ . '/../../sources/classes/classMapper.php';
 | |
|     }
 | |
| } |