File: TestUtil.php

package info (click to toggle)
php-openid 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,928 kB
  • ctags: 6,167
  • sloc: php: 22,223; python: 376; xml: 333; sh: 144; perl: 103; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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');
}