Completed
Pull Request — master (#2)
by Siwapun
13:33
created

EqualTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 27
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testEqualsWithObjectAndExpectFalse() 0 7 1
A testEqualsWithPrimitiveValueAndExpectTrue() 0 4 1
A testEqualsWithPrimitiveValueAndExpectFalse() 0 4 1
A testEqualsWithObjectAndExpectTrue() 0 7 1
1
<?php
2
namespace Aerophant\RamdaTest;
3
4
use function Aerophant\Ramda\equals;
5
use Aerophant\RamdaTest\Asset\PlainObjectAsset;
6
use PHPUnit\Framework\TestCase;
7
8
class EqualTest extends TestCase
9
{
10
  public function testEqualsWithPrimitiveValueAndExpectTrue()
11
  {
12
    $this->assertTrue(equals(1)(1));
13
    $this->assertTrue(equals('someString')('someString'));
14
  }
15
  public function testEqualsWithPrimitiveValueAndExpectFalse()
16
  {
17
    $this->assertFalse(equals(1)(2));
18
    $this->assertFalse(equals('someString')('anotherString'));
19
  }
20
  public function testEqualsWithObjectAndExpectTrue()
21
  {
22
    $obj1 = new PlainObjectAsset();
23
    $obj1->setData('data');
24
    $obj2 = new PlainObjectAsset();
25
    $obj2->setData('data');
26
    $this->assertTrue(equals($obj1)($obj2));
27
  }
28
  public function testEqualsWithObjectAndExpectFalse()
29
  {
30
    $obj1 = new PlainObjectAsset();
31
    $obj1->setData('data');
32
    $obj2 = new PlainObjectAsset();
33
    $obj2->setData('anotherData');
34
    $this->assertFalse(equals($obj1)($obj2));
35
  }
36
}
37