Completed
Pull Request — master (#22)
by Siwapun
03:42
created

ReverseTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testReverseUnsupportedType() 0 4 1
A testReverseString() 0 6 1
A testReverseEmptyString() 0 6 1
A testReverseArray() 0 6 1
A testReverseEmptyArray() 0 6 1
1
<?php
2
3
namespace Aerophant\RamdaTest;
4
5
use function Aerophant\Ramda\reverse;
6
use PHPUnit\Framework\TestCase;
7
8
class ReverseTest extends TestCase
9
{
10
  public function testReverseArray()
11
  {
12
    $list = [1, 2, 3];
13
    $expect = [3, 2, 1];
14
    $actual = reverse()($list);
15
    $this->assertEquals($expect, $actual);
16
  }
17
18
  public function testReverseEmptyArray()
19
  {
20
    $list = [];
21
    $expect = [];
22
    $actual = reverse()($list);
23
    $this->assertEquals($expect, $actual);
24
  }
25
26
  public function testReverseString()
27
  {
28
    $list = 'abc';
29
    $expect = 'cba';
30
    $actual = reverse()($list);
31
    $this->assertEquals($expect, $actual);
32
  }
33
  public function testReverseEmptyString()
34
  {
35
    $list = '';
36
    $expect = '';
37
    $actual = reverse()($list);
38
    $this->assertEquals($expect, $actual);
39
  }
40
41
  public function testReverseUnsupportedType()
42
  {
43
    $this->expectException(\InvalidArgumentException::class);
44
    reverse()(100);
45
  }
46
}
47