Code Duplication    Length = 13-13 lines in 3 locations

Tests/EventListener/JmsPreSerializeListenerTest.php 3 locations

@@ 115-127 (lines=13) @@
112
    /**
113
     * Test serialization with included host in the URI
114
     */
115
    public function testSerializationWithIncludedHost()
116
    {
117
        $user = (new Fixtures\UserA())
118
            ->setPhotoName('photo.jpg')
119
            ->setCoverName('cover.jpg');
120
121
        $context = DeserializationContext::create();
122
        $event = new ObjectEvent($context, $user, []);
123
        $this->dispatcher->dispatch(JmsEvents::PRE_SERIALIZE, Fixtures\UserA::class, $context->getFormat(), $event);
124
125
        $this->assertEquals('http://example.com/uploads/photo.jpg', $user->getPhotoName());
126
        $this->assertEquals('http://example.com/uploads/cover.jpg', $user->getCoverName());
127
    }
128
129
    /**
130
     * Test serialization without included host in the URI
@@ 132-144 (lines=13) @@
129
    /**
130
     * Test serialization without included host in the URI
131
     */
132
    public function testSerializationWithoutIncludedHost()
133
    {
134
        $user = (new Fixtures\UserB())
135
            ->setPhotoName('photo.jpg')
136
            ->setCoverName('cover.jpg');
137
138
        $context = DeserializationContext::create();
139
        $event = new ObjectEvent($context, $user, []);
140
        $this->dispatcher->dispatch(JmsEvents::PRE_SERIALIZE, Fixtures\UserB::class, $context->getFormat(), $event);
141
142
        $this->assertEquals('http://example.com/uploads/photo.jpg', $user->getPhotoName());
143
        $this->assertEquals('/uploads/cover.jpg', $user->getCoverName());
144
    }
145
146
    /**
147
     * Test serialization without included host in the URI
@@ 151-163 (lines=13) @@
148
     *
149
     * @expectedException \Fresh\VichUploaderSerializationBundle\Exception\IncompatibleUploadableAndSerializableFieldAnnotationException
150
     */
151
    public function testExceptionForIncompatibleAnnotations()
152
    {
153
        $user = (new Fixtures\UserC())
154
            ->setPhotoName('photo.jpg')
155
            ->setCoverName('cover.jpg');
156
157
        $context = DeserializationContext::create();
158
        $event = new ObjectEvent($context, $user, []);
159
        $this->dispatcher->dispatch(JmsEvents::PRE_SERIALIZE, Fixtures\UserC::class, $context->getFormat(), $event);
160
161
        $this->assertEquals('http://example.com/uploads/photo.jpg', $user->getPhotoName());
162
        $this->assertEquals('/uploads/cover.jpg', $user->getCoverName());
163
    }
164
165
    /**
166
     * Test serialization of the same object twice