Completed
Push — master ( 4783ce...1821eb )
by Dennis
03:38
created

SimpleXmlRandomItemAccessBench::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * (c) Dennis Meckel
5
 *
6
 * For the full copyright and license information,
7
 * please view the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Rayne\wz2008\Graph\Benchmark\Graph;
11
12
use Rayne\wz2008\Graph\Benchmark\RandomItemAccessCase;
13
use Rayne\wz2008\Graph\Factory\WzClassificationFactory;
14
use SimpleXMLElement;
15
16
class SimpleXmlRandomItemAccessBench extends RandomItemAccessCase
17
{
18
    /**
19
     * @var SimpleXMLElement
20
     */
21
    public $xml;
22
23
    /**
24
     *
25
     */
26
    public function __construct()
27
    {
28
        $this->xml = simplexml_load_file($this->getAssetFile(WzClassificationFactory::SUPPLIED_CLASSIFICATION_FILE));
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function benchRandomItemAccess($params)
35
    {
36
        $child = $this->xml->xpath('//Item[@id="' . $params['id'] . '"][1]')[0];
37
38
        $this->assertSame($params['id'], (string) $child['id']);
39
    }
40
}
41