Remove dependency on deprecated YAML library.

Use spec-provided JSON files instead.
This commit is contained in:
Justin Hileman
2022-08-09 11:19:28 -07:00
parent 64e5609d0e
commit e6256ea0d7
5 changed files with 5 additions and 17 deletions
-3
View File
@@ -1,6 +1,3 @@
[submodule "vendor/spec"]
path = vendor/spec
url = https://github.com/mustache/spec.git
[submodule "vendor/yaml"]
path = vendor/yaml
url = https://github.com/fabpot/yaml.git
@@ -49,9 +49,10 @@ class Mustache_Test_FiveThree_Functional_MustacheSpecTest extends Mustache_Test_
private function prepareLambdasSpec($data)
{
foreach ($data as $key => $val) {
if ($key === 'lambda') {
if (isset($val['__tag__']) && $val['__tag__'] === 'code') {
if (!isset($val['php'])) {
$this->markTestSkipped(sprintf('PHP lambda test not implemented for this test.'));
return;
}
$func = $val['php'];
+3 -10
View File
@@ -28,7 +28,7 @@ abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase
/**
* Data provider for the mustache spec test.
*
* Loads YAML files from the spec and converts them to PHPisms.
* Loads JSON files from the spec and converts them to PHPisms.
*
* @param string $name
*
@@ -36,21 +36,14 @@ abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase
*/
protected function loadSpec($name)
{
$filename = dirname(__FILE__) . '/../../../vendor/spec/specs/' . $name . '.yml';
$filename = dirname(__FILE__) . '/../../../vendor/spec/specs/' . $name . '.json';
if (!file_exists($filename)) {
return array();
}
$data = array();
$yaml = new sfYamlParser();
$file = file_get_contents($filename);
// @hack: pre-process the 'lambdas' spec so the Symfony YAML parser doesn't complain.
if ($name === '~lambdas') {
$file = str_replace(" !code\n", "\n", $file);
}
$spec = $yaml->parse($file);
$spec = json_decode($file, true);
foreach ($spec['tests'] as $test) {
$data[] = array(
-2
View File
@@ -13,8 +13,6 @@ require dirname(__FILE__) . '/../src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
Mustache_Autoloader::register(dirname(__FILE__) . '/../test');
require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php';
/**
* Minimal stream wrapper to test protocol-based access to templates.
*/
Vendored
-1
Submodule vendor/yaml deleted from 8a266aadce