Completed
Push — master ( 064eaa...847d00 )
by Siwapun
06:40 queued 04:59
created

MeanTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 15
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMeanWithEmptyArray() 0 5 1
A testMean() 0 6 1
1
<?php
2
3
namespace Aerophant\RamdaTest;
4
5
use function Aerophant\Ramda\mean;
6
use PHPUnit\Framework\TestCase;
7
8
class MeanTest extends TestCase
9
{
10
  public function testMean()
11
  {
12
    $numbers = [2, 7, 9];
13
    $expect = 6;
14
    $actual = mean()($numbers);
15
    $this->assertEquals($expect, $actual);
16
  }
17
18
  public function testMeanWithEmptyArray()
19
  {
20
    $this->expectException(\InvalidArgumentException::class);
21
    $numbers = [];
22
    mean()($numbers);
23
  }
24
}
25