Skip to content

Commit 8a1e184

Browse files
sebastianbergmanndas-peter
authored andcommitted
Make YAML an optional dependency.
1 parent 1c56254 commit 8a1e184

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

PHPUnit/Util/Log/TAP.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
require_once 'PHPUnit/Util/Filter.php';
4848
require_once 'PHPUnit/Util/Printer.php';
4949
require_once 'PHPUnit/Util/Test.php';
50-
require_once 'SymfonyComponents/YAML/sfYamlDumper.php';
50+
51+
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('SymfonyComponents/YAML/sfYamlDumper.php')) {
52+
require_once 'SymfonyComponents/YAML/sfYamlDumper.php';
53+
}
5154

5255
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
5356

@@ -137,14 +140,16 @@ public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_Asser
137140
}
138141
}
139142

140-
$yaml = new sfYamlDumper();
143+
if (class_exists('sfYamlDumper')) {
144+
$yaml = new sfYamlDumper;
141145

142-
$this->write(
143-
sprintf(
144-
" ---\n%s ...\n",
145-
$yaml->dump($diagnostic, 2, 2)
146-
)
147-
);
146+
$this->write(
147+
sprintf(
148+
" ---\n%s ...\n",
149+
$yaml->dump($diagnostic, 2, 2)
150+
)
151+
);
152+
}
148153
}
149154

150155
/**

package.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,6 @@
11021102
<pearinstaller>
11031103
<min>1.8.1</min>
11041104
</pearinstaller>
1105-
<package>
1106-
<name>YAML</name>
1107-
<channel>pear.symfony-project.com</channel>
1108-
<min>1.0.2</min>
1109-
</package>
11101105
<extension>
11111106
<name>dom</name>
11121107
</extension>
@@ -1130,6 +1125,11 @@
11301125
<name>Log</name>
11311126
<channel>pear.php.net</channel>
11321127
</package>
1128+
<package>
1129+
<name>YAML</name>
1130+
<channel>pear.symfony-project.com</channel>
1131+
<min>1.0.2</min>
1132+
</package>
11331133
<extension>
11341134
<name>json</name>
11351135
</extension>

0 commit comments

Comments
 (0)