Completed
Push — master ( fef923...c0df34 )
by Rafael
03:03
created

testGetSetPropertyWriter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/**
4
 * LICENSE: This file is subject to the terms and conditions defined in
5
 * file 'LICENSE', which is part of this source code package.
6
 *
7
 * @copyright 2016 Copyright(c) - All rights reserved.
8
 */
9
10
namespace Rafrsr\LibArray2Object\Tests;
11
12
use Rafrsr\LibArray2Object\Array2ObjectContext;
13
use Rafrsr\LibArray2Object\Matcher\CamelizeMatcher;
14
use Rafrsr\LibArray2Object\Parser\IntegerParser;
15
use Rafrsr\LibArray2Object\Parser\StringParser;
16
use Rafrsr\LibArray2Object\Writer\AccessorWriter;
17
18
class Array2ObjectContextTest extends \PHPUnit_Framework_TestCase
19
{
20 View Code Duplication
    public function testGetSetParsers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        $context = new Array2ObjectContext();
23
        $parsers = [new StringParser(), new IntegerParser()];
24
        $context->setParsers($parsers);
25
26
        static::assertEquals(['string' => new StringParser(), 'integer' => new IntegerParser()], $context->getParsers());
27
    }
28
29 View Code Duplication
    public function testAppendParsers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        $context = new Array2ObjectContext();
32
        $parsers = [new StringParser()];
33
        $context->setParsers($parsers);
34
        $context->appendParser(new IntegerParser());
35
        static::assertEquals(['string' => new StringParser(), 'integer' => new IntegerParser()], $context->getParsers());
36
    }
37
38 View Code Duplication
    public function testPrependParsers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        $context = new Array2ObjectContext();
41
        $parsers = [new StringParser(), new IntegerParser()];
42
        $context->setParsers($parsers);
43
        $context->prependParser(new IntegerParser());
44
        static::assertEquals(['integer' => new IntegerParser(), 'string' => new StringParser()], $context->getParsers());
45
    }
46
47
    public function testGetSetPropertyMatcher()
48
    {
49
        $context = new Array2ObjectContext();
50
        $matcher = new CamelizeMatcher();
51
        $context->setMatcher($matcher);
52
        static::assertEquals($matcher, $context->getMatcher());
53
    }
54
55
    public function testGetSetPropertyWriter()
56
    {
57
        $context = new Array2ObjectContext();
58
        $writer = new AccessorWriter();
59
        $context->setWriter($writer);
60
        static::assertEquals($writer, $context->getWriter());
61
    }
62
}
63