* * 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:----B4KsEE3I03isslQUKeguI9qAn2MhHwNgg24nxU6fy5CTLKKKh8OkVb0COc/DCuaP7P+KK26TvWZ6tBhwBKWP8eC/jHD+Z3e3r1Zy7SwXdx+CfkI6U0ZOBiFDG9dEgw9aM6OzheCp7Z3nowECH7ojFIMmiYsmb39XvcAfraC5EyjI63xARUwSDubQrwG5+W8h8OU/O04Mw5Z5oCirs7/6DU/1ir8JmZq0tR1L9295oBesXORXwJduLTrBUzAdt7qQv9ENtlOUtyDIkrNeVcdiDuUgOpY3+G+obQBnLN0KzFuu3vcfP5PHVxtYOYx6vwB4igKQPCrcpPVPe0lh+wpXQSAt5ww6tjpookmaWWyWwp/JSLDKv5/2/m46vNlD5CAKxAFDur3dMBQIj/mEpJpxQJe2hQN3glIr8vpvxFxKlJd1JaQKNtpOcKySMCaFtvTT55lfC/aph0LqP+VulMFkZkwgpUC+16+AgQfZkMeocCHBiYzuKOGLupuJsSHjAdgaZ5JENcmigwxSKSV0jVf7SioKZoIFU7Xzx4wMd7vWbZtGK3E7TrDa/AsgEyibbr2yw0kmKZgMDpClTArAH2pBMr6GkrBVT2BKpx5CyLqO3TfdCHBGkK3YGkpN2HrcQPDtGR7QhBUVi0v+eSlAcssNZIaZKERik0wBFObOkEHC9Uw=----ATTACHMENT:----OTUzMzAyNTQ5NjExODA4IDk2Mjk1NTc1NjcyNzY5MjAgODY1MTkyMzg3MTI2MTYwMQ==