Code Duplication    Length = 26-28 lines in 3 locations

tests/Sensorario/Resources/ResourceTest.php 2 locations

@@ 462-489 (lines=28) @@
459
     * @expectedException              Sensorario\Resources\Exceptions\UnexpectedValueException
460
     * @expectedExceptionMessageRegExp #Value `.*` is not allowed for key `.*`. Allowed values are:#
461
     */
462
    public function testAllowedValues()
463
    {
464
        $configurator = new Configurator(
465
            'foo',
466
            new Container([
467
                'resources' => [
468
                    'foo' => [
469
                        'constraints' => [
470
                            'allowed' => [ 'user_type' ],
471
                            'allowedValues' => [
472
                                'user_type' => [
473
                                    4, 
474
                                    7,
475
                                ],
476
                            ],
477
                        ],
478
                    ],
479
                ],
480
            ])
481
        );
482
483
        $properties = [ 'user_type' => 3 ];
484
485
        Resource::box(
486
            $properties,
487
            $configurator
488
        );
489
    }
490
491
    public function testRewriteRulesWithCondition()
492
    {
@@ 548-575 (lines=28) @@
545
     * @expectedException              Sensorario\Resources\Exceptions\OutOfRangeException
546
     * @expectedExceptionMessageRegExp #Value `.*` is out of range: `.*`.#
547
     */
548
    public function testAcceptRangeOfValues()
549
    {
550
        $configurator = new Configurator(
551
            'foo',
552
            new Container([
553
                'resources' => [
554
                    'foo' => [
555
                        'constraints' => [
556
                            'allowedRanges' => [
557
                                'age' => [
558
                                    'more_than' => 3,
559
                                    'less_than' => 42,
560
                                ],
561
                            ],
562
                            'allowed' => [
563
                                'age'
564
                            ],
565
                        ],
566
                    ],
567
                ],
568
            ])
569
        );
570
571
        Resource::box(
572
            [ 'age' => 2 ],
573
            $configurator
574
        );
575
    }
576
577
    public function testAllResourcesInheritGlobalAllowingConfiguration()
578
    {

tests/Sensorario/Resources/RulerTest.php 1 location

@@ 25-50 (lines=26) @@
22
     * @expectedException \Sensorario\Resources\Exceptions\InvalidCustomValidatorException
23
     * @expectedExceptionMessage Oops! `custom-validator` custom validator is not available. Only email is.
24
     */
25
    public function test()
26
    {
27
        $configurator = new Configurator(
28
            'foo',
29
            new Container([
30
                'resources' => [
31
                    'foo' => [
32
                        'constraints' => [
33
                            'allowed' => [
34
                                'property_name',
35
                            ],
36
                            'rules' => [
37
                                'property_name' => [
38
                                    'custom-validator' => 'foo',
39
                                ]
40
                            ]
41
                        ],
42
                    ],
43
                ]
44
            ])
45
        );
46
47
        Resource::box([
48
            'property_name' => '42',
49
        ], $configurator);
50
    }
51
52
    public function setUp()
53
    {