Code Duplication    Length = 35-36 lines in 2 locations

tests/Sensorario/Resources/ResourceTest.php 2 locations

@@ 466-501 (lines=36) @@
463
     * @expectedException              Sensorario\Resources\Exceptions\PropertyNotSetException
464
     * @expectedExceptionMessageRegExp #Property `.*::.*` is mandatory but not set#
465
     */
466
    public function testDependentMandatoryProperties()
467
    {
468
        $configurator = new Configurator(
469
            'foo',
470
            new Container([
471
                'resources' => [
472
                    'foo' => [
473
                        'constraints' => [
474
                            'allowed' => [
475
                                'bar',
476
                            ],
477
                            'mandatory' => [
478
                                'mandatory_property_name',
479
                                'foo' => [
480
                                    'when' => [
481
                                        'property' => 'bar',
482
                                        'condition' => 'is_present',
483
                                    ]
484
                                ],
485
                            ],
486
                        ]
487
                    ],
488
                ],
489
            ])
490
        );
491
492
        $properties = [
493
            'mandatory_property_name' => '42',
494
            'bar' => 'beer',
495
        ];
496
497
        Resource::box(
498
            $properties,
499
            $configurator
500
        );
501
    }
502
503
    public function testMandatoryConstraintsAreAutomaticallyAllowed()
504
    {
@@ 684-718 (lines=35) @@
681
    /**
682
     * @expectedException Sensorario\Resources\Exceptions\PropertyException
683
     */
684
    public function testHasMandatoryPropertiesWhenAnotherOneHasAParticularValue()
685
    {
686
        $configurator = new Configurator(
687
            'foo',
688
            new Container([
689
                'resources' => [
690
                    'foo' => [
691
                        'constraints' => [
692
                            'allowed' => [
693
                                'bar',
694
                            ],
695
                            'mandatory' => [
696
                                'mandatory_property_name',
697
                                'foo' => [
698
                                    'when' => [
699
                                        'property' => 'bar',
700
                                        'has_value' => '42',
701
                                    ]
702
                                ],
703
                            ],
704
                        ]
705
                    ],
706
                ],
707
            ])
708
        );
709
710
        $properties = [
711
            'bar' => '42',
712
        ];
713
714
        Resource::box(
715
            $properties,
716
            $configurator
717
        );
718
    }
719
720
    /**
721
     * @expectedException Sensorario\Resources\Exceptions\EmailException