Remove dependency on deprecated YAML library.
Use spec-provided JSON files instead.
This commit is contained in:
@@ -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'];
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user