-
Notifications
You must be signed in to change notification settings - Fork 48
/
NanodicomCoreTest.php
51 lines (43 loc) · 1.01 KB
/
NanodicomCoreTest.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
require_once 'nanodicom.php';
class NanodicomCoreTest extends PHPUnit_Framework_TestCase
{
/**
* @dataProvider provider
*/
public function testSummary($output, $expected)
{
$this->assertEquals($output, $expected);
}
/**
*/
public function provider()
{
$samples_dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'samples'.DIRECTORY_SEPARATOR;
$output_dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR;
$files = array();
if ($handle = opendir($samples_dir))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != ".." && is_file($samples_dir.$file))
{
$files[] = $file;
}
}
closedir($handle);
}
$data = array();
foreach ($files as $file)
{
$filename = $samples_dir.$file;
$dicom = Nanodicom::factory($filename);
$data[] = array(
$dicom->summary(),
file_get_contents($output_dir.$file.'.summary.txt'),
);
unset($dicom);
}
return $data;
}
}