-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGenericDiffReporter.php
More file actions
34 lines (27 loc) · 1.04 KB
/
Copy pathGenericDiffReporter.php
File metadata and controls
34 lines (27 loc) · 1.04 KB
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
<?php
namespace ApprovalTests\Reporters;
use ApprovalTests\SystemUtil;
class GenericDiffReporter implements Reporter
{
public static $STANDARD_ARGUMENTS = "%s %s";
public static $TEXT_FILE_EXTENSIONS = [".txt", ".csv", ".htm", ".html", ".xml", ".eml",
".java", ".css", ".js", ".json"];
public static $IMAGE_FILE_EXTENSIONS = [".png", ".gif", ".jpg", ".jpeg", ".bmp", ".tif",
".tiff"];
private $diffProgram;
private $fileExtensions;
private $parameters;
public function __construct($diffProgram, array $fileExtensions, $parameters) {
$this->diffProgram = $diffProgram;
$this->fileExtensions = $fileExtensions;
$this->parameters = $parameters;
}
public function report($approvedFilename, $receivedFilename)
{
SystemUtil::execInBackground(sprintf('"%s" ' . $this->parameters, $this->diffProgram, $receivedFilename, $approvedFilename));
}
public function isWorkingInThisEnvironment($receivedFilename)
{
return is_executable($this->diffProgram);
}
}