getMockBuilder(SerializationVisitorInterface::class)->getMock(); $visitor->method('visitArray')->with(['foo'])->willReturn(['foo']); $context = $this->getMockBuilder(SerializationContext::class)->getMock(); $type = ['name' => 'ArrayCollection', 'params' => []]; $collection = new ArrayCollection(['foo']); $handler->serializeCollection($visitor, $collection, $type, $context); } /** * @doesNotPerformAssertions */ public function testSerializeArraySkipByExclusionStrategy() { $handler = new ArrayCollectionHandler(false); $visitor = $this->getMockBuilder(SerializationVisitorInterface::class)->getMock(); $visitor->method('visitArray')->with([])->willReturn([]); $context = $this->getMockBuilder(SerializationContext::class)->getMock(); $factoryMock = $this->getMockBuilder(MetadataFactoryInterface::class)->getMock(); $factoryMock->method('getMetadataForClass')->willReturn(new ClassMetadata(ArrayCollection::class)); $context->method('getExclusionStrategy')->willReturn(new AlwaysExcludeExclusionStrategy()); $context->method('getMetadataFactory')->willReturn($factoryMock); $type = ['name' => 'ArrayCollection', 'params' => []]; $collection = new ArrayCollection(['foo']); $handler->serializeCollection($visitor, $collection, $type, $context); } }