You are here

public function ParserTest::testSpecifications in Lockr 7.3

@dataProvider getDataFormSpecifications

File

vendor/symfony/yaml/Tests/ParserTest.php, line 40

Class

ParserTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testSpecifications($expected, $yaml, $comment, $deprecated) {
  $deprecations = [];
  if ($deprecated) {
    set_error_handler(function ($type, $msg) use (&$deprecations) {
      if (E_USER_DEPRECATED !== $type) {
        restore_error_handler();
        if (class_exists('PHPUnit_Util_ErrorHandler')) {
          return \call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', \func_get_args());
        }
        return \call_user_func_array('PHPUnit\\Util\\ErrorHandler::handleError', \func_get_args());
      }
      $deprecations[] = $msg;
    });
  }
  $this
    ->assertEquals($expected, var_export($this->parser
    ->parse($yaml), true), $comment);
  if ($deprecated) {
    restore_error_handler();
    $this
      ->assertCount(1, $deprecations);
    $this
      ->assertContains(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]);
  }
}