1: <?php
2:
3: /**
4: * XSLT Benchmarking
5: * @link https://github.com/masicek/XSLT-Benchmarking
6: * @author Viktor Mašíček <viktor@masicek.net>
7: * @license "New" BSD License
8: */
9:
10: namespace XSLTBenchmarking\TestsGenerator;
11:
12: require_once LIBS . '/PhpPath/PhpPath.min.php';
13: require_once ROOT . '/DriversContainer.php';
14:
15: use PhpPath\P;
16:
17: /**
18: * Object for work with params of xslt template
19: *
20: * @author Viktor Mašíček <viktor@masicek.net>
21: */
22: class Params extends \XSLTBenchmarking\DriversContainer
23: {
24:
25:
26: /**
27: * Return the name of file with params of the test
28: * Default value is '__params.xml'.
29: *
30: * @param string $testName The name of the selected test
31: *
32: * @return string
33: */
34: public function getTestParamsFileName($testName)
35: {
36: $name = $this->driver->getTestParamsFileName($testName);
37: if (!$name)
38: {
39: // TODO in future based on driver
40: $name = '__params.xml';
41: }
42: return $name;
43: }
44:
45:
46: /**
47: * Choose the params driver by extension of params file
48: *
49: * @param string $paramsFilePath The path of the file with deffinition of generated tests
50: *
51: * @throws \XSLTBenchmarking\InvalidArgumentException Wrong format of file with params
52: */
53: public function setFile($paramsFilePath)
54: {
55: P::cf($paramsFilePath);
56: $extension = pathinfo(P::m($paramsFilePath), PATHINFO_EXTENSION);
57: return $this->setDriver($extension, $paramsFilePath);
58: }
59:
60:
61: }
62: