Overview
Namespaces
Classes
- AMemoryUsageDriver
- AProcessorDriver
- Controlor
- Libxslt1123phpProcessorDriver
- Libxslt1126phpProcessorDriver
- LinuxMemoryUsageDriver
- MemoryUsage
- MSXML30ProcessorDriver
- MSXML60ProcessorDriver
- Params
- Processor
- Runner
- Sablotron103cmdProcessorDriver
- Saxon655ProcessorDriver
- SaxonHE9402ProcessorDriver
- Test
- TestRunner
- WindowsMemoryUsageDriver
- Xalan271ProcessorDriver
- XmlParamsDriver
- Xsltproc1123ProcessorDriver
- Xsltproc1126ProcessorDriver
- XT20051206ProcessorDriver
Interfaces
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\TestsRunner;
11:
12: require_once LIBS . '/PhpPath/PhpPath.min.php';
13: require_once ROOT . '/Exceptions.php';
14:
15: use PhpPath\P;
16:
17: /**
18: * Container for information about one test.
19: *
20: * @author Viktor Mašíček <viktor@masicek.net>
21: */
22: class Test
23: {
24:
25:
26: /**
27: * Name of the test
28: *
29: * @var string
30: */
31: private $name;
32:
33: /**
34: * Path of the XSLT template
35: *
36: * @var string
37: */
38: private $templatePath;
39:
40: /**
41: * Couples of XML inpiut and expected output files
42: *
43: * @var array ([input] => [expected output], ...)
44: */
45: private $couples;
46:
47:
48: /**
49: * Set name of the test
50: *
51: * @param string $name Name of the test
52: */
53: public function __construct($name)
54: {
55: $this->name = $name;
56: }
57:
58:
59: /**
60: * Return name of the test
61: *
62: * @return string
63: */
64: public function getName()
65: {
66: return $this->name;
67: }
68:
69:
70: /**
71: * Set path of XSLT template
72: *
73: * @param string $templatePath The path of XSLT template
74: *
75: * @return void
76: */
77: public function setTemplatePath($templatePath)
78: {
79: $templatePath = P::mcf($templatePath);
80:
81: $extension = pathinfo($templatePath, PATHINFO_EXTENSION);
82: if ($extension != 'xsl' && $extension != 'xslt')
83: {
84: throw new \XSLTBenchmarking\InvalidArgumentException('XSLT template path does not have extension ".xsl" or ".xslt". It has value "' . $templatePath . '"');
85: }
86:
87: $this->templatePath = $templatePath;
88: }
89:
90:
91: /**
92: * Return path of XSLT template
93: *
94: * @return string
95: */
96: public function getTemplatePath()
97: {
98: return $this->templatePath;
99: }
100:
101:
102: /**
103: * Add couples of input and expected output XML files
104: *
105: * @param array $couples ([input] => [expected output], ...)
106: *
107: * @return void
108: */
109: public function addCouplesPaths(array $couples)
110: {
111: foreach ($couples as $input => $expectedOutput)
112: {
113: $inputExtension = pathinfo($input, PATHINFO_EXTENSION);
114: if ($inputExtension != 'xml')
115: {
116: throw new \XSLTBenchmarking\InvalidArgumentException('XSLT template path does not have extension ".xml". It has value "' . $input . '"');
117: }
118: $this->couples[P::mcf($input)] = P::mcf($expectedOutput);
119:
120: }
121: }
122:
123:
124: /**
125: * Return couples of input and expected output XML files
126: *
127: * @return array ([input] => [expected output], ...)
128: */
129: public function getCouplesPaths()
130: {
131: return $this->couples;
132: }
133:
134:
135: }
136: