MinkowskiTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testMinkowskiAngelicaHailey() 0 6 1
A testMinkowskiNoMatch() 0 7 1
1
<?php
2
3
namespace stojg\recommend\tests;
4
5
use stojg\recommend\strategy\Minkowski;
6
7
class MinkowskiTest extends \PHPUnit_Framework_TestCase
8
{
9
    protected $set;
10
11
    public function setUp()
12
    {
13
        $data = file_get_contents(__DIR__.'/../fixtures/users.json');
14
        $this->set = json_decode($data, true);
15
    }
16
17
    public function testMinkowskiAngelicaHailey()
18
    {
19
        $paerson = new Minkowski(2);
20
        $score = $paerson->run($this->set['Angelica'], $this->set['Hailey']);
21
        $this->assertEquals(2.7386127875258, $score);
22
    }
23
24
    public function testMinkowskiNoMatch()
25
    {
26
        $set = json_decode(file_get_contents(__DIR__.'/../fixtures/users_nomatch.json'), true);
27
        $paerson = new Minkowski(2);
28
        $score = $paerson->run($set['Andrea'], $set['Bob']);
29
        $this->assertFalse($score);
30
    }
31
}
32