summaryrefslogtreecommitdiffstats
path: root/Tests/Services/Yadis/TestUtil.php
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Services/Yadis/TestUtil.php')
-rw-r--r--Tests/Services/Yadis/TestUtil.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/Tests/Services/Yadis/TestUtil.php b/Tests/Services/Yadis/TestUtil.php
new file mode 100644
index 0000000..e6d7a57
--- /dev/null
+++ b/Tests/Services/Yadis/TestUtil.php
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * Utilites for test functions
+ */
+
+function Tests_Services_Yadis_datafile($name, $reader)
+{
+ $path = dirname(realpath(__FILE__));
+ $sep = DIRECTORY_SEPARATOR;
+ $filename = $path . $sep . 'data' . $sep . $name;
+ $data = $reader($filename);
+ if ($data === false) {
+ $msg = "Failed to open data file: $name";
+ trigger_error($msg, E_USER_ERROR);
+ }
+ return $data;
+}
+
+function Tests_Services_Yadis_readdata($name)
+{
+ return Tests_Services_Yadis_datafile($name, 'file_get_contents');
+}
+
+function Tests_Services_Yadis_readlines($name)
+{
+ return Tests_Services_Yadis_datafile($name, 'file');
+}