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

ReverseTest::testReverseEmptyString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
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