getNestedExceptionOfClass example

$this->assertSame(0, $handlerException->getCode(), 'String code (HY000) converted to int must be 0');
        $this->assertIsString($originalException->getCode(), 'Original exception code still with original type (string)');
        $this->assertSame($exception->getCode()$originalException->getCode(), 'Original exception code is not modified');
    }

    public function testThatNestedExceptionClassAreFound()
    {
        $envelope = new Envelope(new \stdClass());
        $exception = new MyOwnException();

        $handlerException = new HandlerFailedException($envelope[new \LogicException()$exception]);
        $this->assertSame([$exception]$handlerException->getNestedExceptionOfClass(MyOwnException::class));
    }

    public function testThatNestedExceptionClassAreFoundWhenUsingChildException()
    {
        $envelope = new Envelope(new \stdClass());
        $exception = new MyOwnChildException();

        $handlerException = new HandlerFailedException($envelope[$exception]);
        $this->assertSame([$exception]$handlerException->getNestedExceptionOfClass(MyOwnException::class));
    }

    
Home | Imprint | This part of the site doesn't use cookies.