UkhmtTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 3
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 15 1
A testRun() 0 8 1
1
<?php
2
3
namespace ADiaz\AML\OpenList\parsers;
4
5
use ADiaz\AML\OpenList\utils\Exporter;
6
7
/**
8
 * This file is part of the OpenList Parser utility.
9
 *
10
 *
11
 * @category  PHP
12
 *
13
 * @author    Alberto Diaz <[email protected]>
14
 * @copyright 2016 Alberto Diaz <[email protected]>
15
 * @license   This source file is subject to the MIT license that is bundled
16
 *
17
 * @version   Release: @package_version@
18
 *
19
 * @link      http://tytem.com
20
 */
21
class UkhmtTest extends \PHPUnit_Framework_TestCase
22
{
23
    protected $parser;
24
    protected $output_file;
25
    protected $output_folder;
26
27
    protected function setUp()
28
    {
29
        // output file and folder
30
        $this->output_folder = __DIR__.'/../../../output/';
31
        $this->output_file = $this->output_folder.'test_ukhmt_'.date('Y-m-d').'.json';
32
33
        // parser
34
        $this->parser = new Ukhmt();
35
        $this->parser->setSourcePath(__DIR__.'/../fixtures/lists/ukhmt_2016-03-25.csv');
36
        $this->parser->run();
37
38
        // export
39
        $exporter = new Exporter($this->output_folder);
40
        $exporter->json($this->parser->getEntities(), 'test_ukhmt');
41
    }
42
43
    public function testRun()
44
    {
45
        $this->parser->run();
46
47
        $entitiesOk = json_decode(file_get_contents($this->output_file), true);
48
49
        $this->assertEquals(count($this->parser->getEntities()), count($entitiesOk), 'The number of sanctions should be the same');
50
    }
51
}
52