Remove dependency on deprecated YAML library.
Use spec-provided JSON files instead.
This commit is contained in:
@@ -1,6 +1,3 @@
|
|||||||
[submodule "vendor/spec"]
|
[submodule "vendor/spec"]
|
||||||
path = vendor/spec
|
path = vendor/spec
|
||||||
url = https://github.com/mustache/spec.git
|
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)
|
private function prepareLambdasSpec($data)
|
||||||
{
|
{
|
||||||
foreach ($data as $key => $val) {
|
foreach ($data as $key => $val) {
|
||||||
if ($key === 'lambda') {
|
if (isset($val['__tag__']) && $val['__tag__'] === 'code') {
|
||||||
if (!isset($val['php'])) {
|
if (!isset($val['php'])) {
|
||||||
$this->markTestSkipped(sprintf('PHP lambda test not implemented for this test.'));
|
$this->markTestSkipped(sprintf('PHP lambda test not implemented for this test.'));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$func = $val['php'];
|
$func = $val['php'];
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase
|
|||||||
/**
|
/**
|
||||||
* Data provider for the mustache spec test.
|
* 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
|
* @param string $name
|
||||||
*
|
*
|
||||||
@@ -36,21 +36,14 @@ abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
protected function loadSpec($name)
|
protected function loadSpec($name)
|
||||||
{
|
{
|
||||||
$filename = dirname(__FILE__) . '/../../../vendor/spec/specs/' . $name . '.yml';
|
$filename = dirname(__FILE__) . '/../../../vendor/spec/specs/' . $name . '.json';
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$yaml = new sfYamlParser();
|
|
||||||
$file = file_get_contents($filename);
|
$file = file_get_contents($filename);
|
||||||
|
$spec = json_decode($file, true);
|
||||||
// @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);
|
|
||||||
|
|
||||||
foreach ($spec['tests'] as $test) {
|
foreach ($spec['tests'] as $test) {
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ require dirname(__FILE__) . '/../src/Mustache/Autoloader.php';
|
|||||||
Mustache_Autoloader::register();
|
Mustache_Autoloader::register();
|
||||||
Mustache_Autoloader::register(dirname(__FILE__) . '/../test');
|
Mustache_Autoloader::register(dirname(__FILE__) . '/../test');
|
||||||
|
|
||||||
require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal stream wrapper to test protocol-based access to templates.
|
* Minimal stream wrapper to test protocol-based access to templates.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Vendored
-1
Submodule vendor/yaml deleted from 8a266aadce
Reference in New Issue
Block a user