<?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__ . '/../data/A.php';
        require_once __DIR__ . '/../data/B.php';
        require_once __DIR__ . '/../../sources/classes/classMapper.php';
    }
}