public function setUp() { $this->urlMatcher = $this->getMockForAbstractClass(UrlMatcherInterface::class); $this->resourceTransformer = $this->getMockForAbstractClass(TransformerInterface::class); $this->kernel = $this->getMockForAbstractClass(HttpKernelInterface::class); $this->context = $this->getMockBuilder(RequestContext::class)->disableOriginalConstructor()->getMock(); $this->urlMatcher->method('getContext')->willReturn($this->context); }