Test doubles: Difference between revisions

No edit summary
Line 214: Line 214:
=== getMockFromWsdl() ===
=== getMockFromWsdl() ===
Although PHPUnit 9.x allows you to build a mock for a web service from a [[wp:WSDL]] file, the <code>getMockFromWsdl()</code> method is deprecated in current versions and removed in PHPUnit 12. This is because people don't use SOAP and WSDL as commonly as they used to, and even if they do, they don't rely on PHP's SOAP extension <ref>[https://github.com/sebastianbergmann/phpunit/issues/5242 Deprecate TestCase::getMockFromWsdl()]</ref>.
Although PHPUnit 9.x allows you to build a mock for a web service from a [[wp:WSDL]] file, the <code>getMockFromWsdl()</code> method is deprecated in current versions and removed in PHPUnit 12. This is because people don't use SOAP and WSDL as commonly as they used to, and even if they do, they don't rely on PHP's SOAP extension <ref>[https://github.com/sebastianbergmann/phpunit/issues/5242 Deprecate TestCase::getMockFromWsdl()]</ref>.
A bit sad, but understandable. PHPUnit can't keep 20 years of legacy implementations along with new technologies.
In PHPUnit 9.6, you can easily mock a Google Web Search<ref>https://docs.phpunit.de/en/9.6/test-doubles.html#stubbing-and-mocking-web-services</ref>


{{References}}
{{References}}