<?php

namespace Opentalent\OtCore\Tests\Unit\Exception;

use Exception;
use Nimut\TestingFramework\TestCase\UnitTestCase;
use Opentalent\OtCore\Exception\ApiRequestException;

class ApiRequestExceptionTest extends UnitTestCase
{
    /**
     * Construction from another exception
     *
     * @test
     */
    public function from_exception() {

        $e = new Exception("msg", 1, new Exception());

        $result = ApiRequestException::from_exception($e);

        $this->assertEquals($result->getMessage(), $result->getMessage());
        $this->assertEquals($result->getCode(), $result->getCode());
        $this->assertEquals($result->getPrevious(), $result->getPrevious());
    }
}
