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

MatchTest::testUnmatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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