GenericTest::itShouldCheckIfIsRequired()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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