public function testUpdateStorage() { $image = new LocalImage(); $image->upload('old', 'old'); $this->em->persist($image); $this->em->flush(); $this->storage->expects($this->once())->method('moveImage')->with($this->equalTo('images/old'))->will($this->returnValue('a/bc/abc.jpg')); $this->storage->expects($this->once())->method('moveThumbnail')->with($this->equalTo('images/thumbnails/old'))->will($this->returnValue('a/bc/abc.jpg')); $this->assertFalse($image->hasUpdatedStorage()); $this->service->updateStorage(); $this->assertTrue($image->hasUpdatedStorage()); $this->assertEquals('images/a/bc/abc.jpg', $image->getPath()); $this->assertEquals('images/thumbnails/a/bc/abc.jpg', $image->getThumbnailPath()); }