public function testDestructorCallsCurlCloseOnUsedObject() { $uriMock = $this->getMockForAbstractClass('\\Psr\\Http\\Message\\UriInterface'); $uriMock->method('getScheme')->willReturn('ftp'); $this->request->method('getUri')->willReturn($uriMock); $this->getFunctionMock(self::SUT_NAMESPACE, 'curl_exec')->expects($this->any())->willReturn(true); $this->getFunctionMock(self::SUT_NAMESPACE, 'curl_setopt_array')->expects($this->any())->willReturn(true); $this->subjectUnderTest->execute(); $this->getFunctionMock(self::SUT_NAMESPACE, 'curl_close')->expects($this->atLeastOnce()); $this->subjectUnderTest->__destruct(); }