Code Duplication    Length = 7-8 lines in 8 locations

tests/ResolverTest.php 8 locations

@@ 87-93 (lines=7) @@
84
     * @param stdClass $schema
85
     * @param string   $pointerUri
86
     */
87
    public function testResolveThrowsOnUnresolvedPointerProperty(stdClass $schema, $pointerUri)
88
    {
89
        $this->resolver->initialize($schema, new Uri('file:///foo/bar'));
90
        $reference = new stdClass();
91
        $reference->{'$ref'} = $pointerUri;
92
        $this->resolver->resolve($reference);
93
    }
94
95
    /**
96
     * @dataProvider invalidPointerIndexProvider
@@ 102-108 (lines=7) @@
99
     * @param stdClass $schema
100
     * @param string   $pointerUri
101
     */
102
    public function testResolveThrowsOnInvalidPointerIndex(stdClass $schema, $pointerUri)
103
    {
104
        $this->resolver->initialize($schema, new Uri('file:///foo/bar'));
105
        $reference = new stdClass();
106
        $reference->{'$ref'} = $pointerUri;
107
        $this->resolver->resolve($reference);
108
    }
109
110
    /**
111
     * @dataProvider unresolvablePointerIndexProvider
@@ 117-123 (lines=7) @@
114
     * @param stdClass $schema
115
     * @param string   $pointerUri
116
     */
117
    public function testResolveThrowsOnUnresolvedPointerIndex(stdClass $schema, $pointerUri)
118
    {
119
        $this->resolver->initialize($schema, new Uri('file:///foo/bar'));
120
        $reference = new stdClass();
121
        $reference->{'$ref'} = $pointerUri;
122
        $this->resolver->resolve($reference);
123
    }
124
125
    /**
126
     * @dataProvider invalidPointerSegmentProvider
@@ 132-138 (lines=7) @@
129
     * @param stdClass $schema
130
     * @param string   $pointerUri
131
     */
132
    public function testResolveThrowsOnInvalidPointerSegment(stdClass $schema, $pointerUri)
133
    {
134
        $this->resolver->initialize($schema, new Uri('file:///foo/bar'));
135
        $reference = new stdClass();
136
        $reference->{'$ref'} = $pointerUri;
137
        $this->resolver->resolve($reference);
138
    }
139
140
    /**
141
     * @dataProvider invalidPointerTargetProvider
@@ 147-153 (lines=7) @@
144
     * @param stdClass $schema
145
     * @param string   $pointerUri
146
     */
147
    public function testResolveThrowsOnInvalidPointerTarget(stdClass $schema, $pointerUri)
148
    {
149
        $this->resolver->initialize($schema, new Uri('file:///foo/bar'));
150
        $reference = new stdClass();
151
        $reference->{'$ref'} = $pointerUri;
152
        $this->resolver->resolve($reference);
153
    }
154
155
    /**
156
     * @dataProvider selfReferencingPointerProvider
@@ 175-181 (lines=7) @@
172
     *
173
     * @param string $pointerUri
174
     */
175
    public function testResolveThrowsOnUnfetchableUri($pointerUri)
176
    {
177
        $this->resolver->initialize(new stdClass(), new Uri('file:///foo/bar'));
178
        $reference = new stdClass();
179
        $reference->{'$ref'} = $pointerUri;
180
        $this->resolver->resolve($reference);
181
    }
182
183
    /**
184
     * @group network
@@ 202-209 (lines=8) @@
199
    /**
200
     * @expectedException \JVal\Exception\JsonDecodeException
201
     */
202
    public function testResolveThrowsOnUndecodableRemoteSchema()
203
    {
204
        $this->resolver->initialize(new stdClass(), new Uri('file:///foo/bar'));
205
        $schemaFile = __DIR__.'/Data/schemas/invalid/undecodable.json';
206
        $reference = new stdClass();
207
        $reference->{'$ref'} = $this->getLocalUri($schemaFile);
208
        $this->resolver->resolve($reference);
209
    }
210
211
    /**
212
     * @expectedException \JVal\Exception\Resolver\InvalidRemoteSchemaException
@@ 214-221 (lines=8) @@
211
    /**
212
     * @expectedException \JVal\Exception\Resolver\InvalidRemoteSchemaException
213
     */
214
    public function testResolveThrowsOnInvalidRemoteSchema()
215
    {
216
        $this->resolver->initialize(new stdClass(), new Uri('file:///foo/bar'));
217
        $schemaFile = __DIR__.'/Data/schemas/invalid/not-an-object.json';
218
        $reference = new stdClass();
219
        $reference->{'$ref'} = $this->getLocalUri($schemaFile);
220
        $this->resolver->resolve($reference);
221
    }
222
223
    public function rootRefProvider()
224
    {