InstantiatorTest\InstantiatorTest::testNoticeOnUnSerializationException PHP Method

testNoticeOnUnSerializationException() public method

    public function testNoticeOnUnSerializationException()
    {
        if (\PHP_VERSION_ID >= 50600) {
            $this->markTestSkipped('PHP 5.6 supports `ReflectionClass#newInstanceWithoutConstructor()` for some internal classes');
        }
        ob_start();
        try {
            $this->instantiator->instantiate('InstantiatorTestAsset\\WakeUpNoticesAsset');
            ob_end_clean();
            $this->fail('No exception was raised');
        } catch (UnexpectedValueException $exception) {
            $wakeUpNoticesReflection = new ReflectionClass('InstantiatorTestAsset\\WakeUpNoticesAsset');
            $previous = $exception->getPrevious();
            $this->assertInstanceOf('Exception', $previous);
            // in PHP 5.4.29 and PHP 5.5.13, this case is not a notice, but an exception being thrown
            if (!(\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513)) {
                $this->assertSame('Could not produce an instance of "InstantiatorTestAsset\\WakeUpNoticesAsset" via un-serialization, ' . 'since an error was triggered in file "' . $wakeUpNoticesReflection->getFileName() . '" at line "35"', $exception->getMessage());
                $this->assertSame('Something went bananas while un-serializing this instance', $previous->getMessage());
                $this->assertSame(\E_USER_NOTICE, $previous->getCode());
            }
        }
        ob_end_clean();
    }