File: update-reference-output.php

package info (click to toggle)
php-dompdf 3.0.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,548 kB
  • sloc: php: 26,160; sh: 109; xml: 100; makefile: 42
file content (31 lines) | stat: -rw-r--r-- 913 bytes parent folder | download
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
<?php
use Dompdf\Tests\OutputTest\Dataset;
use Dompdf\Tests\OutputTest\OutputTest;

/**
 * Usage:
 * * `php bin/update-reference-output.php` to update the reference files for all
 *   test cases
 * * `php bin/update-reference-output.php <name-prefix>` to update the reference
 *   files for all test cases with a path starting with the specified prefix
 *   (paths considered relative to the parent `OutputTest` directory)
 */
require __DIR__ . "/../vendor/autoload.php";

$pathTest = $argv[1] ?? "";
$datasets = OutputTest::datasets();
$include = $pathTest !== ""
    ? function (Dataset $set) use ($pathTest) {
        return substr($set->name, 0, strlen($pathTest)) === $pathTest;
    } : function () {
        return true;
    };

foreach ($datasets as $dataset) {
    if (!$include($dataset)) {
        continue;
    }

    echo "Updating " . $dataset->name . PHP_EOL;
    $dataset->updateReferenceFile();
}