Code Duplication    Length = 31-33 lines in 2 locations

tests/Sensorario/Resources/ResourceTest.php 2 locations

@@ 747-777 (lines=31) @@
744
    }
745
746
    /** @dataProvider rules */
747
    public function testRulesKnowsIfRuleIsDefinedOrNot($expectation, $ruleName)
748
    {
749
        $configurator = new Configurator(
750
            'email-resource',
751
            new Container([
752
                'resources' => [
753
                    'email-resource' => [
754
                        'constraints' => [
755
                            'mandatory' => [
756
                                'first-email',
757
                            ],
758
                            'rules' => [
759
                                'first-email' => [ 'custom-validator' => 'email' ],
760
                            ],
761
                        ]
762
                    ],
763
                ],
764
            ])
765
        );
766
767
        $properties = [
768
            'first-email' => '[email protected]',
769
        ];
770
771
        $resource = Resource::box($properties, $configurator);
772
773
        $this->assertEquals(
774
            $expectation,
775
            $resource->isRuleDefinedFor($ruleName)
776
        );
777
    }
778
779
    public function rules()
780
    {
@@ 787-819 (lines=33) @@
784
        ];
785
    }
786
787
    public function testProvideRule()
788
    {
789
        $aSpecificRule = [ 'custom-validator' => 'email' ];
790
791
        $configurator = new Configurator(
792
            'email-resource',
793
            new Container([
794
                'resources' => [
795
                    'email-resource' => [
796
                        'constraints' => [
797
                            'mandatory' => [
798
                                'first-email',
799
                            ],
800
                            'rules' => [
801
                                'first-email' => $aSpecificRule,
802
                            ],
803
                        ]
804
                    ],
805
                ],
806
            ])
807
        );
808
809
        $properties = [
810
            'first-email' => '[email protected]',
811
        ];
812
813
        $resource = Resource::box($properties, $configurator);
814
815
        $this->assertEquals(
816
            $aSpecificRule,
817
            $resource->getRule('first-email')->asArray()
818
        );
819
    }
820
821
    /**
822
     * @expectedException Sensorario\Resources\Exceptions\PropertyWithoutRuleException