Array2ObjectContextTest::testAppendParsers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the rafrsr/lib-array2object package.
5
 *
6
 * (c) Rafael SR <https://github.com/rafrsr>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Rafrsr\LibArray2Object\Tests;
12
13
use Rafrsr\LibArray2Object\Array2ObjectContext;
14
use Rafrsr\LibArray2Object\Matcher\CamelizeMatcher;
15
use Rafrsr\LibArray2Object\Parser\IntegerParser;
16
use Rafrsr\LibArray2Object\Parser\StringParser;
17
use Rafrsr\LibArray2Object\Writer\AccessorWriter;
18
19
class Array2ObjectContextTest extends \PHPUnit_Framework_TestCase
20
{
21 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...
22
    {
23
        $context = new Array2ObjectContext();
24
        $parsers = [new StringParser(), new IntegerParser()];
25
        $context->setParsers($parsers);
26
27
        static::assertEquals(['string' => new StringParser(), 'integer' => new IntegerParser()], $context->getParsers());
28
    }
29
30 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...
31
    {
32
        $context = new Array2ObjectContext();
33
        $parsers = [new StringParser()];
34
        $context->setParsers($parsers);
35
        $context->appendParser(new IntegerParser());
36
        static::assertEquals(['string' => new StringParser(), 'integer' => new IntegerParser()], $context->getParsers());
37
    }
38
39 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...
40
    {
41
        $context = new Array2ObjectContext();
42
        $parsers = [new StringParser(), new IntegerParser()];
43
        $context->setParsers($parsers);
44
        $context->prependParser(new IntegerParser());
45
        static::assertEquals(['integer' => new IntegerParser(), 'string' => new StringParser()], $context->getParsers());
46
    }
47
48 View Code Duplication
    public function testGetSetPropertyMatcher()
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...
49
    {
50
        $context = new Array2ObjectContext();
51
        $matcher = new CamelizeMatcher();
52
        $context->setMatcher($matcher);
53
        static::assertEquals($matcher, $context->getMatcher());
54
    }
55
56 View Code Duplication
    public function testGetSetPropertyWriter()
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...
57
    {
58
        $context = new Array2ObjectContext();
59
        $writer = new AccessorWriter();
60
        $context->setWriter($writer);
61
        static::assertEquals($writer, $context->getWriter());
62
    }
63
}
64