* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Debug\Tests\FatalErrorHandler; use PHPUnit\Framework\TestCase; use Symfony\Component\Debug\Exception\FatalErrorException; use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; class UndefinedMethodFatalErrorHandlerTest extends TestCase { /** * @dataProvider provideUndefinedMethodData */ public function testUndefinedMethod($error, $translatedMessage) { $handler = new UndefinedMethodFatalErrorHandler(); $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); $this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedMethodException', $exception); $this->assertSame($translatedMessage, $exception->getMessage()); $this->assertSame($error['type'], $exception->getSeverity()); $this->assertSame($error['file'], $exception->getFile()); $this->assertSame($error['line'], $exception->getLine()); } public function provideUndefinedMethodData() { return array( array( array( 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::what()', ), 'Attempted to call an undefined method named "what" of class "SplObjectStorage".', ), array( array( 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::walid()', ), "Attempted to call an undefined method named \"walid\" of class \"SplObjectStorage\".\nDid you mean to call \"valid\"?", ), array( array( 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::offsetFet()', ), "Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?", ), array( array( 'type' => 1, 'message' => 'Call to undefined method class@anonymous::test()', 'file' => '/home/possum/work/symfony/test.php', 'line' => 11, ), 'Attempted to call an undefined method named "test" of class "class@anonymous".', ), ); } } __halt_compiler();----SIGNATURE:----vaOrLNh5R8ziETFLRuoLTdzjmnL6mUOqZ6Jf+SCQv3D2CefHq0R0k6dDgweC3sLaH7W/UuHphaWMWmeNFWdG+71RbMavW981fFUg6+N284oiO62pve/7OVC6KvzW9Z8zLsq4esJIfIwEs8BJR7+rxnRuV4/Qa7WeaakQeZEJyOjgEadPBVY5SH+ChW/Mu7Tm5CQMTg+8lDf1ytA9KexIrClLqR/A98dkhxsxxvi/fdIbLvxTXGU/RsJETdtO13qJBJ96cdAWdUJK3fbL2VZKgJltTb/EnL5Jr569vdahmk9r8INLmP8Mjw+ge32dG8UHx9jo2WK1zdOBdPGn4Lv+L+LaiKShCDcVdMSBs0i7CK3JPwRBceYr//VoISBPvMe4C22SC6S7uz0yixgQ1qEgVOeF7HC40AbpKVOvvkByY1daK4br17UsOFFVkVYJ7heUUWQ1ExX5nFMo94S4uBahpFBmZQvfLyBTpQmqdzP1so8ECKkJeZ19tffxOeiu57gsWZ5u3DlJJzWgH4wU0pzFLFhZzr2202+eJZaLdnsXbbH4/jdADco3ecPh0sK4u+EusteO3nVN3m6HRkbkQ8KMVU7J838/KqZjMBMJCC4StT0vUliHknEtWuxeKfxcs3b5HE61jcbsNBohFzLHoxDQ1+qY1RBir2H0oHCQU5y9iGU=----ATTACHMENT:----MTU2MTc1OTgxMTI4MzEzNiAyMjg1Njk5NTk2MTM4ODg2IDE3OTE1NjUyNjMzNDU2NTA=