Skip to content

Commit e6256ea

Browse files
committed
Remove dependency on deprecated YAML library.
Use spec-provided JSON files instead.
1 parent 64e5609 commit e6256ea

File tree

5 files changed

+5
-17
lines changed

5 files changed

+5
-17
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "vendor/spec"]
22
path = vendor/spec
33
url = https://github.com/mustache/spec.git
4-
[submodule "vendor/yaml"]
5-
path = vendor/yaml
6-
url = https://github.com/fabpot/yaml.git

test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ public function loadLambdasSpec()
4949
private function prepareLambdasSpec($data)
5050
{
5151
foreach ($data as $key => $val) {
52-
if ($key === 'lambda') {
52+
if (isset($val['__tag__']) && $val['__tag__'] === 'code') {
5353
if (!isset($val['php'])) {
5454
$this->markTestSkipped(sprintf('PHP lambda test not implemented for this test.'));
55+
return;
5556
}
5657

5758
$func = $val['php'];

test/Mustache/Test/SpecTestCase.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,22 @@ protected static function loadTemplate($source, $partials)
2828
/**
2929
* Data provider for the mustache spec test.
3030
*
31-
* Loads YAML files from the spec and converts them to PHPisms.
31+
* Loads JSON files from the spec and converts them to PHPisms.
3232
*
3333
* @param string $name
3434
*
3535
* @return array
3636
*/
3737
protected function loadSpec($name)
3838
{
39-
$filename = dirname(__FILE__) . '/../../../vendor/spec/specs/' . $name . '.yml';
39+
$filename = dirname(__FILE__) . '/../../../vendor/spec/specs/' . $name . '.json';
4040
if (!file_exists($filename)) {
4141
return array();
4242
}
4343

4444
$data = array();
45-
$yaml = new sfYamlParser();
4645
$file = file_get_contents($filename);
47-
48-
// @hack: pre-process the 'lambdas' spec so the Symfony YAML parser doesn't complain.
49-
if ($name === '~lambdas') {
50-
$file = str_replace(" !code\n", "\n", $file);
51-
}
52-
53-
$spec = $yaml->parse($file);
46+
$spec = json_decode($file, true);
5447

5548
foreach ($spec['tests'] as $test) {
5649
$data[] = array(

test/bootstrap.php

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
Mustache_Autoloader::register();
1414
Mustache_Autoloader::register(dirname(__FILE__) . '/../test');
1515

16-
require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php';
17-
1816
/**
1917
* Minimal stream wrapper to test protocol-based access to templates.
2018
*/

vendor/yaml

-1
This file was deleted.

0 commit comments

Comments
 (0)