GenericTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 34
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A itShouldCheckIfIsRequired() 0 10 1
A itShouldCheckIsNotNull() 0 14 1
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 9/20/14
5
 * Time: 11:52 AM
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Tests\NilPortugues\Validator\Validation;
12
13
use NilPortugues\Validator\Validation\GenericValidation;
14
15
/**
16
 * Class GenericAttributeTest
17
 * @package Tests\NilPortugues\Validator\Validation
18
 */
19
class GenericTest extends \PHPUnit_Framework_TestCase
20
{
21
    /**
22
     * @test
23
     */
24
    public function itShouldCheckIfIsRequired()
25
    {
26
        $value  = 'asdsdadds';
27
        $result = GenericValidation::isRequired($value);
28
        $this->assertTrue($result);
29
30
        $value  = null;
31
        $result = GenericValidation::isRequired($value);
32
        $this->assertFalse($result);
33
    }
34
35
    /**
36
     * @test
37
     */
38
    public function itShouldCheckIsNotNull()
39
    {
40
        $value  = 'asdsdadds';
41
        $result = GenericValidation::isNotNull($value);
42
        $this->assertTrue($result);
43
44
        $value  = null;
45
        $result = GenericValidation::isNotNull($value);
46
        $this->assertFalse($result);
47
48
        $value  = '';
49
        $result = GenericValidation::isNotNull($value);
50
        $this->assertFalse($result);
51
    }
52
}
53