Completed
Push — master ( 24a9b5...f93101 )
by Siwapun
03:29
created

MatchTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testMatch() 0 7 1
A testUnmatch() 0 7 1
1
<?php
2
3
namespace Aerophant\RamdaTest;
4
5
use function Aerophant\Ramda\match;
6
use PHPUnit\Framework\TestCase;
7
8
class MatchTest extends TestCase
9
{
10
  public function testMatch()
11
  {
12
    $pattern = '/^([a-z]+)-([0-9]+)$/';
13
    $testString = 'cat-009';
14
    $expect = ['cat-009', 'cat', '009'];
15
    $actual = match($pattern, $testString);
16
    $this->assertEquals($expect, $actual);
17
  }
18
19
  public function testUnmatch()
20
  {
21
    $pattern = '/^([a-z]+)-([0-9]+)$/';
22
    $testString = 'cat009';
23
    $expect = [];
24
    $actual = match($pattern, $testString);
25
    $this->assertEquals($expect, $actual);
26
  }
27
}
28