diff options
Diffstat (limited to 'models/openid-php-openid-782224d/Tests/Auth/Yadis/TestUtil.php')
-rw-r--r-- | models/openid-php-openid-782224d/Tests/Auth/Yadis/TestUtil.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/models/openid-php-openid-782224d/Tests/Auth/Yadis/TestUtil.php b/models/openid-php-openid-782224d/Tests/Auth/Yadis/TestUtil.php new file mode 100644 index 000000000..6c2581251 --- /dev/null +++ b/models/openid-php-openid-782224d/Tests/Auth/Yadis/TestUtil.php @@ -0,0 +1,30 @@ +<?php + +/** + * Utilites for test functions + */ + +function Tests_Auth_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_Auth_Yadis_readdata($name) +{ + return Tests_Auth_Yadis_datafile($name, 'file_get_contents'); +} + +function Tests_Auth_Yadis_readlines($name) +{ + return Tests_Auth_Yadis_datafile($name, 'file'); +} + + |