<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>接口 on PlumePHP</title><link>https://plumephp.com/tags/%E6%8E%A5%E5%8F%A3/</link><description>Recent content in 接口 on PlumePHP</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Thu, 24 Oct 2024 09:46:00 +0800</lastBuildDate><atom:link href="https://plumephp.com/tags/%E6%8E%A5%E5%8F%A3/index.xml" rel="self" type="application/rss+xml"/><item><title>Go 测试替身入门：用小接口写出容易测试的业务代码</title><link>https://plumephp.com/go-test-doubles-interfaces-2024/</link><pubDate>Thu, 24 Oct 2024 09:46:00 +0800</pubDate><guid>https://plumephp.com/go-test-doubles-interfaces-2024/</guid><description>&lt;p&gt;很多初学者一听到“单元测试”，就想到 mock 框架。其实 Go 里最常用、最舒服的测试替身，往往只是一个小结构体。你定义一个刚好够用的小接口，测试里手写 fake 或 spy，就能验证业务逻辑，而不用真的发邮件、调支付或连外部 API。&lt;/p&gt;</description></item></channel></rss>