public function attachTo(FileLibrary $filelib)
 {
     $serializer = new AsynchronyDataSerializer();
     $serializer->attachTo($filelib);
     $this->queue->addDataSerializer($serializer);
     $this->attached = true;
 }
 /**
  * @test
  */
 public function serializesAndUnserializesAfterUpload()
 {
     $filelib = new FileLibrary(new MemoryStorageAdapter(), new MemoryBackendAdapter());
     $file = $filelib->getFileRepository()->upload(ROOT_TESTS . '/data/self-lussing-manatee.jpg');
     $serializer = new AsynchronyDataSerializer();
     $serializer->attachTo($filelib);
     $unserializedCallback = new SerializedCallback([$filelib->getFileRepository(), 'afterUpload'], [$file]);
     $this->assertTrue($serializer->willSerialize($unserializedCallback));
     $serializedCallback = $serializer->serialize($unserializedCallback);
     $deserializedCallback = $serializer->unserialize($serializedCallback);
     $this->assertEquals($unserializedCallback, $deserializedCallback);
 }