{"id":3279,"date":"2024-10-18T15:45:01","date_gmt":"2024-10-18T07:45:01","guid":{"rendered":"https:\/\/www.openbyt.com\/?p=3279"},"modified":"2024-10-18T15:52:40","modified_gmt":"2024-10-18T07:52:40","slug":"how-to-implement-automated-testing-in-your-wordpress-workflow","status":"publish","type":"post","link":"https:\/\/www.openbyt.com\/zh\/\u5982\u4f55\u5728\u60a8\u7684-wordpress-\u5de5\u4f5c\u6d41\u7a0b\u4e2d\u5be6\u65bd\u81ea\u52d5\u5316\u6e2c\u8a66","title":{"rendered":"\u5982\u4f55\u5728 WordPress \u5de5\u4f5c\u6d41\u7a0b\u4e2d\u57f7\u884c\u81ea\u52d5\u5316\u6e2c\u8a66"},"content":{"rendered":"<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-ad2f72ca wp-block-group-is-layout-flex\"><p>\u5c0d WordPress \u958b\u767c\u4eba\u54e1\u4f86\u8aaa\uff0c\u81ea\u52d5\u5316\u6e2c\u8a66\u53ef\u80fd\u6703\u8b93\u4ed6\u5011\u611f\u5230\u61fc\u6015\uff0c\u4e3b\u8981\u662f\u5982\u679c\u60a8\u5f9e\u672a\u8655\u7406\u904e\u81ea\u52d5\u5316\u6e2c\u8a66\u7684\u8a71\u3002\u5c07\u5b83\u60f3\u50cf\u6210\u5728\u8d70\u92fc\u7d22\u6642\u7684\u5b89\u5168\u7db2\uff0c\u4e00\u65e6\u5230\u4f4d\uff0c\u5c31\u80fd\u78ba\u4fdd\u5373\u4f7f\u51fa\u932f\uff0c\u60a8\u4e5f\u80fd\u53d7\u5230\u4fdd\u8b77\u3002\u5c31\u50cf\u5b89\u5168\u7db2\u80fd\u6355\u6349\u932f\u8aa4\u4e00\u6a23\uff0c\u81ea\u52d5\u5316\u6e2c\u8a66\u4e5f\u80fd\u5728\u932f\u8aa4\u9032\u5165\u751f\u7522\u4e4b\u524d\u6355\u6349\u5b83\u5011\u3002\u4f46\u5728\u91cd\u8996\u7a69\u5b9a\u3001\u6548\u7387\u548c\u64f4\u5145\u80fd\u529b\u7684\u958b\u767c\u4e16\u754c\u4e2d\uff0c\u81ea\u52d5\u5316\u6e2c\u8a66\u662f\u60a8\u53ef\u4ee5\u63a1\u7528\u4f86\u7c21\u5316\u5de5\u4f5c\u6d41\u7a0b\u7684\u6700\u6709\u6548\u5de5\u5177\u4e4b\u4e00\u3002\u672c\u6307\u5357\u5c08\u70ba\u5e0c\u671b\u63d0\u5347\u54c1\u8cea\u4fdd\u8b49\u6d41\u7a0b\u4e26\u6210\u70ba\u5c08\u696d\u4eba\u58eb\u7684 WordPress \u958b\u767c\u4eba\u54e1\u6240\u64b0\u5beb\u3002\u6211\u5c07\u5f15\u5c0e\u60a8\u8a2d\u5b9a\u81ea\u52d5\u5316\u6e2c\u8a66\uff0c\u4e26\u63d0\u4f9b\u5b8c\u6574\u7684\u7a0b\u5f0f\u78bc\u7bc4\u4f8b\u548c\u5be6\u7528\u8aaa\u660e\u3002<\/p><\/div><figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d.webp\" alt=\"\" class=\"wp-image-3299\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d.webp 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d-600x600.webp 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d-100x100.webp 100w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d-300x300.webp 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d-150x150.webp 150w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d-768x768.webp 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d-12x12.webp 12w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.34.00-A-WordPress-developer-walking-a-tightrope-with-a-supportive-visible-safety-net-below-labeled-Automated-Testing.-The-developer-is-holding-a-laptop-d-96x96.webp 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><h3 class=\"wp-block-heading\">\u4ec0\u9ebc\u662f\u81ea\u52d5\u5316\u6e2c\u8a66\uff1f<\/h3><p>\u7c21\u55ae\u4f86\u8aaa\uff0c\u81ea\u52d5\u5316\u6e2c\u8a66\u662f\u4e00\u7a2e\u65b9\u6cd5\uff0c\u53ef\u78ba\u4fdd\u60a8\u6240\u5beb\u7684\u7a0b\u5f0f\u78bc\u80fd\u5982\u9810\u671f\u822c\u904b\u4f5c\uff0c\u800c\u7121\u9700\u624b\u52d5\u6aa2\u67e5\u6bcf\u500b\u529f\u80fd\u3002\u5b83\u662f\u95dc\u65bc\u57f7\u884c\u8173\u672c\uff0c\u4ee5\u9a57\u8b49\u60a8\u61c9\u7528\u7a0b\u5f0f\u7684\u4e0d\u540c\u65b9\u9762\u3002\u9019\u500b\u5916\u639b\u7a0b\u5f0f\u5728\u6700\u65b0\u66f4\u65b0\u4e4b\u5f8c\u662f\u5426\u4ecd\u7136\u904b\u4f5c\uff1f\u4e3b\u984c\u81ea\u8a02\u662f\u5426\u4ecd\u80fd\u6b63\u5e38\u5448\u73fe\uff1f\u81ea\u52d5\u5316\u6e2c\u8a66\u6709\u52a9\u65bc\u5728\u958b\u767c\u751f\u547d\u9031\u671f\u4e2d\u53ca\u65e9\u767c\u73fe\u6f5b\u5728\u554f\u984c\uff0c\u70ba\u60a8\u7bc0\u7701\u7121\u6578\u7684\u932f\u8aa4\u4fee\u5fa9\u8207\u9664\u932f\u6642\u9593\u3002<\/p><p>WordPress \u7684\u81ea\u52d5\u5316\u6e2c\u8a66\u53ef\u4ee5\u5305\u542b\u55ae\u5143\u6e2c\u8a66\u3001\u6574\u5408\u6e2c\u8a66\uff0c\u751a\u81f3\u662f\u7aef\u5c0d\u7aef\u6e2c\u8a66\uff0c\u6db5\u84cb\u5c0f\u81f3\u908f\u8f2f\u7247\u6bb5\uff0c\u5927\u81f3\u5b8c\u6574\u5448\u73fe\u7684\u7db2\u9801\u3002\u8b93\u6211\u5011\u4f86\u770b\u770b\u5982\u4f55\u5c07\u81ea\u52d5\u6e2c\u8a66\u6574\u5408\u5230 WordPress \u958b\u767c\u5de5\u4f5c\u6d41\u7a0b\u4e2d\u3002<\/p><figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and.webp\" alt=\"\" class=\"wp-image-3300\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and.webp 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and-600x600.webp 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and-100x100.webp 100w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and-300x300.webp 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and-150x150.webp 150w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and-768x768.webp 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and-12x12.webp 12w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-14.30.53-A-developer-working-with-automated-testing-tools-for-WordPress.-The-developer-is-sitting-at-a-desk-surrounded-by-screens-showing-PHPUnit-Cypress-and-96x96.webp 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><h3 class=\"wp-block-heading\">\u8a2d\u5b9a\u60a8\u7684\u74b0\u5883<\/h3><p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u4e00\u500b\u5408\u9069\u7684\u74b0\u5883\u4f86\u958b\u59cb\u3002PHPUnit \u662f WordPress \u7684\u7d55\u4f73\u9078\u64c7\uff0c\u56e0\u70ba\u5b83\u662f\u5c08\u70ba\u6e2c\u8a66 PHP \u7a0b\u5f0f\u78bc\u800c\u8a2d\u8a08\uff0c\u800c PHP \u7a0b\u5f0f\u78bc\u662f WordPress \u5916\u639b\u548c\u4e3b\u984c\u7684\u6838\u5fc3\u3002\u5b83\u5141\u8a31\u958b\u767c\u4eba\u54e1\u9694\u96e2\u500b\u5225\u51fd\u6578\uff0c\u4e26\u5728\u53d7\u63a7\u74b0\u5883\u4e2d\u9a57\u8b49\u5176\u884c\u70ba\uff0c\u56e0\u6b64\u5c0d\u65bc\u5728\u958b\u767c\u521d\u671f\u6355\u6349\u932f\u8aa4\u7279\u5225\u6709\u7528\u3002\u5728 WordPress \u8a2d\u5b9a\u4e2d\u57f7\u884c\u81ea\u52d5\u6e2c\u8a66\u7684\u5e38\u7528\u5de5\u5177\u662f <strong>PHPUnit<\/strong>.PHPUnit \u662f\u55ae\u5143\u6e2c\u8a66 PHP \u7a0b\u5f0f\u78bc\u7684\u5b8c\u7f8e\u5de5\u5177 - WordPress \u5916\u639b\u7a0b\u5f0f\u548c\u4e3b\u984c\u7684\u91cd\u8981\u5143\u4ef6\u3002\u4ee5\u4e0b\u662f\u60a8\u9700\u8981\u8a2d\u5b9a\u7684\u9805\u76ee\uff1a<\/p><ul class=\"wp-block-list\"><li><strong>\u5b89\u88dd PHPUnit<\/strong>:\u78ba\u4fdd\u60a8\u7684\u7cfb\u7d71\u5df2\u5b89\u88dd Composer\uff0c\u56e0\u70ba PHPUnit \u662f\u900f\u904e Composer \u5b89\u88dd\u7684\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\u4f86\u5b89\u88dd\uff1a<\/li><\/ul><p>                 <code>composer require --dev phpunit\/phpunit<\/code><\/p><ul class=\"wp-block-list\"><li><strong>\u8a2d\u5b9a WordPress \u6e2c\u8a66\u5957\u4ef6<\/strong>:\u4e0b\u8f09\u4e26\u8a2d\u5b9a WordPress \u6e2c\u8a66\u51fd\u5f0f\u5eab\u3002\u9019\u662f\u4e00\u500b\u7c21\u5316\u7248\u672c\uff0c\u5047\u8a2d\u60a8\u662f\u5728\u672c\u6a5f\u9032\u884c\u8a2d\u5b9a\uff1a<\/li><\/ul><p>                 <code>bash bin\/install-wp-tests.sh wordpress_test_dbroot 'password' localhost latest<\/code><\/p><figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f.webp\" alt=\"\" class=\"wp-image-3306\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f.webp 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f-600x600.webp 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f-100x100.webp 100w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f-300x300.webp 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f-150x150.webp 150w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f-768x768.webp 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f-12x12.webp 12w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/02c4875e-fbbf-4783-8aae-adbb23947c4f-96x96.webp 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>\u4f7f\u7528\u60a8\u7684\u5be6\u969b\u8cc7\u6599\u5eab\u6191\u8b49\u53d6\u4ee3\u5360\u4f4d\u7b26\u3002\u70ba\u4e86\u52a0\u5f37\u5b89\u5168\u6027\uff0c\u8acb\u907f\u514d\u76f4\u63a5\u5728\u8173\u672c\u4e2d\u786c\u9ad4\u7de8\u78bc\u654f\u611f\u8cc7\u8a0a\u3002\u53d6\u800c\u4ee3\u4e4b\u7684\u662f\uff0c\u8003\u616e\u4f7f\u7528\u74b0\u5883\u8b8a\u6578\u6216\u4e0d\u5728\u7248\u672c\u63a7\u5236\u4e2d\u8ffd\u8e64\u7684\u5b89\u5168\u7d44\u614b\u6a94\u6848\u3002<\/p><h3 class=\"wp-block-heading\">\u64b0\u5beb\u7c21\u55ae\u7684\u55ae\u5143\u6e2c\u8a66<\/h3><p>\u8b93\u6211\u5011\u70ba\u81ea\u8a02\u51fd\u5f0f\u5efa\u7acb\u4e00\u500b\u7c21\u55ae\u7684\u55ae\u5143\u6e2c\u8a66\u3002\u55ae\u5143\u6e2c\u8a66\u7684\u8a2d\u8a08\u662f\u70ba\u4e86\u9a57\u8b49\u55ae\u7368\u7684\u7a0b\u5f0f\u78bc\uff0c\u4f8b\u5982\u51fd\u5f0f\u6216\u65b9\u6cd5\uff0c\u662f\u5426\u80fd\u7368\u7acb\u6b63\u78ba\u904b\u4f5c\u3002\u5b83\u5011\u662f\u81ea\u52d5\u5316\u6e2c\u8a66\u7684\u57fa\u790e\uff0c\u6709\u5225\u65bc\u6574\u5408\u6e2c\u8a66 (\u78ba\u4fdd\u591a\u500b\u5143\u4ef6\u4e00\u8d77\u904b\u4f5c) \u548c\u7aef\u5c0d\u7aef\u6e2c\u8a66 (\u5f9e\u982d\u5230\u5c3e\u6e2c\u8a66\u61c9\u7528\u7a0b\u5f0f\u7684\u6574\u500b\u6d41\u7a0b)\u3002\u5047\u8a2d\u60a8\u7684\u5916\u639b\u7a0b\u5f0f\u4e2d\u6709\u4e00\u500b\u51fd\u6578 calculate_discount()\uff1a<\/p><figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"494\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-1024x494.png\" alt=\"\" class=\"wp-image-3303\" style=\"width:839px;height:auto\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-1024x494.png 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-600x289.png 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-300x145.png 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-768x370.png 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-1536x741.png 1536w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-2048x988.png 2048w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-18x9.png 18w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/screenshot-150x72.png 150w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>\u82e5\u8981\u70ba\u6b64\u51fd\u5f0f\u64b0\u5beb\u55ae\u5143\u6e2c\u8a66\uff0c\u60a8\u9700\u8981\u5728 tests \u8cc7\u6599\u593e\u4e0b\u5efa\u7acb\u65b0\u7684\u6e2c\u8a66\u6a94\u6848\u3002\u4e0b\u9762\u662f\u4e00\u500b\u7bc4\u4f8b\uff1a<\/p><pre class=\"wp-block-code\"><code>\/\/ \u6a94\u6848: my-plugin\/tests\/test-functions.php\n\u4f7f\u7528 PHPUnit\\Framework\\TestCase\uff1b\n\nclass FunctionsTest extends TestCase {\n    public function test_calculate_discount() {\n        require_once dirname(__FILE__) .'\/..\/includes\/functions.php'\uff1b\n\n        $result = calculate_discount(100, 20)\uff1b\n        $this-&gt;assertEquals(80, $result, '20% discount on $100 should return $80')\uff1b\n    }\n\n    public function test_invalid_discount() {\n        $this-&gt;expectException(InvalidArgumentException::class)\uff1b\n        calculate_discount(100, -10)\uff1b\n    }\n}<\/code><\/pre><h3 class=\"wp-block-heading\">\u57f7\u884c\u6e2c\u8a66<\/h3><p>\u5beb\u5b8c\u6e2c\u8a66\u5f8c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e0b\u5217\u6307\u4ee4\u57f7\u884c\uff1a<\/p><p><code>\u4f9b\u61c9\u5546\/bin\/phpunit<\/code><\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P.webp\" alt=\"\" class=\"wp-image-3308\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P.webp 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P-600x600.webp 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P-100x100.webp 100w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P-300x300.webp 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P-150x150.webp 150w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P-768x768.webp 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P-12x12.webp 12w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.20.52-An-illustration-of-a-developer-sitting-at-a-desk-working-on-writing-unit-tests-for-a-WordPress-plugin.-The-developers-screen-shows-code-similar-to-P-96x96.webp 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><h3 class=\"wp-block-heading\">\u4f7f\u7528 Cypress \u9032\u884c\u7aef\u5c0d\u7aef\u6e2c\u8a66<\/h3><p>\u55ae\u5143\u6e2c\u8a66\u662f\u4e00\u500b\u7d55\u4f73\u7684\u8d77\u9ede\uff0c\u4f46\u5c0d\u65bc\u8907\u96dc\u7684 WordPress \u7db2\u7ad9\uff0c\u60a8\u9084\u8981\u6aa2\u67e5\u7db2\u7ad9\u7684\u5b8c\u6574\u529f\u80fd\u3002\u55ae\u5143\u6e2c\u8a66\u8457\u91cd\u65bc\u6e2c\u8a66\u55ae\u7368\u7684\u5143\u4ef6\uff0c\u800c\u6574\u5408\u6e2c\u8a66\u5247\u78ba\u4fdd\u4e0d\u540c\u7684\u6a21\u7d44\u80fd\u5982\u9810\u671f\u822c\u4e00\u8d77\u904b\u4f5c\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u7aef\u5c0d\u7aef\u6e2c\u8a66\u6a21\u64ec\u771f\u5be6\u7684\u4f7f\u7528\u8005\u60c5\u5883\uff0c\u4ee5\u9a57\u8b49\u5f9e\u5f8c\u7aef\u5230\u4f7f\u7528\u8005\u4ecb\u9762\uff0c\u6574\u500b\u7cfb\u7d71\u90fd\u80fd\u5982\u9810\u671f\u822c\u904b\u4f5c\u3002\u9019\u5c31\u662f <strong>\u8cfd\u666e\u62c9\u65af<\/strong> \u4f86\u7684\u3002Cypress \u662f\u4e00\u5957\u4ee5 JavaScript \u70ba\u57fa\u790e\u7684\u7aef\u5c0d\u7aef\u6e2c\u8a66\u5de5\u5177\uff0c\u53ef\u8207 WordPress \u642d\u914d\u4f7f\u7528\uff0c\u4e26\u5141\u8a31\u60a8\u4ee5\u7a0b\u5f0f\u5316\u7684\u65b9\u5f0f\u8207\u5be6\u969b\u7684\u7db2\u9801\u4ecb\u9762\u4e92\u52d5\u3002<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro.webp\" alt=\"\" class=\"wp-image-3309\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro.webp 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-600x600.webp 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-100x100.webp 100w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-300x300.webp 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-150x150.webp 150w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-768x768.webp 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-12x12.webp 12w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-96x96.webp 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>\u9996\u5148\uff0c\u5c07 Cypress \u52a0\u5165\u60a8\u7684\u958b\u767c\u74b0\u5883\uff1a<\/p><p><code>npm install cypress --save-dev<\/code><\/p><p>\u63a5\u4e0b\u4f86\uff0c\u5efa\u7acb\u4e00\u500b\u7c21\u55ae\u7684 Cypress \u6e2c\u8a66\uff0c\u6aa2\u67e5\u60a8\u7684 WordPress \u9996\u9801\u662f\u5426\u80fd\u6b63\u78ba\u8f09\u5165\uff1a<\/p><pre class=\"wp-block-code\"><code>\/\/ \u6a94\u6848\uff1acypress\/integration\/homepage.spec.js\ndescribe(\u300cWordPress \u9996\u9801\u300d, () =&gt; {\n    it('should load the homepage', () =&gt; {\n        cy.visit('http:\/\/localhost:8000')\uff1b\n        cy.contains('Welcome to WordPress').should('be.visible')\uff1b\n    });\n});<\/code><\/pre><p>\u904b\u884c Cypress \u8207\uff1a<\/p><p><code>npx \u6a9c\u6728\u958b\u53e3<\/code><\/p><h3 class=\"wp-block-heading\">\u5c07\u6e2c\u8a66\u6574\u5408\u81f3 CI\/CD \u8f38\u9001\u7ba1\u9053<\/h3><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1.webp\" alt=\"\" class=\"wp-image-3311\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1.webp 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1-600x600.webp 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1-100x100.webp 100w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1-300x300.webp 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1-150x150.webp 150w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1-768x768.webp 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1-12x12.webp 12w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.25.58-An-illustration-of-a-WordPress-testing-process-showing-unit-testing-integration-testing-and-end-to-end-testing.-The-scene-depicts-a-developer-surro-1-96x96.webp 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>\u7576\u81ea\u52d5\u6e2c\u8a66\u8207\u6301\u7e8c\u6574\u5408\/\u6301\u7e8c\u90e8\u7f72 (CI\/CD) \u7ba1\u9053\u6574\u5408\u6642\uff0c\u5c31\u80fd\u767c\u63ee\u6548\u76ca\u3002\u670d\u52d9\u5982 <strong><a href=\"https:\/\/github.com\/features\/actions\" target=\"_blank\" rel=\"noopener\">GitHub \u52d5\u4f5c<\/a><\/strong> \u6216<a href=\"https:\/\/docs.gitlab.com\/ee\/ci\/\" data-type=\"link\" data-id=\"https:\/\/docs.gitlab.com\/ee\/ci\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\"> <strong>GitLab CI<\/strong><\/a> \u5141\u8a31\u60a8\u5728\u6bcf\u6b21\u63a8\u9001\u7a0b\u5f0f\u78bc\u8b8a\u66f4\u6642\u57f7\u884c\u6e2c\u8a66\u3002\u4ee5\u4e0b\u662f PHPUnit \u7684 GitHub Actions YAML \u914d\u7f6e\u7bc4\u4f8b\uff1a.<\/p><pre class=\"wp-block-code\"><code># \u6a94\u6848\uff1a.github\/workflows\/phpunit.yml\n\u540d\u7a31\uff1aPHPUnit \u6e2c\u8a66\n\non\uff1a[push, pull_request]\n\n\u5de5\u4f5c\uff1a\n  test\uff1a\n    runs-on: ubuntu-latest\n\n    \u6b65\u9a5f\uff1a\n    - name: \u7d50\u5e33\u7a0b\u5f0f\u78bc\n      \u4f7f\u7528\uff1aactions\/checkout@v2\n\n    - \u540d\u7a31\uff1a\u8a2d\u5b9a PHP\n      \u4f7f\u7528\uff1ashivammathur\/setup-php@v2\n      \u4f7f\u7528\uff1a\n        php-version: '8.0\n\n    - \u540d\u7a31\uff1a\u5b89\u88dd\u76f8\u4f9d\u6027\n      \u57f7\u884c\uff1acomposer install\n\n    - \u540d\u7a31\uff1a\u57f7\u884c PHPUnit\n      \u57f7\u884c\uff1avendor\/bin\/phpunit<\/code><\/pre><p>\u6bcf\u6b21\u63a8\u9001\u65b0\u7a0b\u5f0f\u78bc\u6216\u63d0\u51fa\u62c9\u53d6\u8acb\u6c42\u6642\uff0c\u6b64\u8a2d\u5b9a\u90fd\u6703\u57f7\u884c\u60a8\u7684\u55ae\u5143\u6e2c\u8a66\u3002\u5728\u9019\u4e9b\u968e\u6bb5\u57f7\u884c\u6e2c\u8a66\u53ef\u78ba\u4fdd\u65b0\u8b8a\u66f4\u4e0d\u6703\u5f15\u5165\u56de\u6b78\u6216\u7834\u58de\u73fe\u6709\u529f\u80fd\uff0c\u6709\u52a9\u65bc\u5728\u6574\u500b\u958b\u767c\u904e\u7a0b\u4e2d\u7dad\u6301\u7a0b\u5f0f\u78bc\u54c1\u8cea\u3002\u900f\u904e\u5728\u7ba1\u9053\u4e2d\u52a0\u5165 Cypress \u6e2c\u8a66\uff0c\u60a8\u53ef\u4ee5\u81ea\u52d5\u9a57\u8b49\u5f8c\u7aef\u908f\u8f2f\u548c\u524d\u7aef\u4e92\u52d5\u3002<\/p><h3 class=\"wp-block-heading\">\u7e3d\u7d50<\/h3><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou.webp\" alt=\"\" class=\"wp-image-3312\" srcset=\"https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou.webp 1024w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou-600x600.webp 600w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou-100x100.webp 100w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou-300x300.webp 300w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou-150x150.webp 150w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou-768x768.webp 768w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou-12x12.webp 12w, https:\/\/www.openbyt.com\/wp-content\/uploads\/2024\/10\/DALL\u00b7E-2024-10-18-15.30.28-An-illustration-showing-a-WordPress-developer-setting-up-automated-testing.-The-developer-is-sitting-at-a-desk-with-multiple-screens-displaying-variou-96x96.webp 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>\u5728 WordPress \u5de5\u4f5c\u6d41\u7a0b\u4e2d\u5be6\u4f5c\u81ea\u52d5\u5316\u6e2c\u8a66\u662f\u6539\u5584\u7a0b\u5f0f\u78bc\u54c1\u8cea\u8207\u53ef\u9760\u6027\u7684\u6c7a\u5b9a\u6027\u6b65\u9a5f\u3002\u7136\u800c\uff0c\u958b\u767c\u4eba\u54e1\u7d93\u5e38\u9762\u81e8\u4e00\u4e9b\u6311\u6230\uff0c\u4f8b\u5982\u8a2d\u5b9a\u6e2c\u8a66\u74b0\u5883\u3001\u7ba1\u7406\u76f8\u4f9d\u6027\uff0c\u4ee5\u53ca\u64b0\u5beb\u4ee4\u4eba\u4fe1\u670d\u7684\u6e2c\u8a66\u6848\u4f8b\u3002\u514b\u670d\u9019\u4e9b\u6311\u6230\u5305\u62ec<\/p><ul class=\"wp-block-list\"><li>\u4ed4\u7d30\u898f\u5283\u3002<\/li>\n\n<li>\u4f7f\u7528\u74b0\u5883\u914d\u7f6e\u7684\u6700\u4f73\u5be6\u52d9\u3002<\/li>\n\n<li>\u5229\u7528\u793e\u5340\u8cc7\u6e90\u89e3\u6c7a\u5171\u540c\u554f\u984c\u3002<\/li><\/ul><p>\u96d6\u7136\u5165\u9580\u53ef\u80fd\u770b\u8d77\u4f86\u5f88\u8f9b\u82e6\uff0c\u4f46\u9577\u671f\u7684\u597d\u8655--\u66f4\u5c11\u7684\u932f\u8aa4\u3001\u66f4\u7c21\u6613\u7684\u7dad\u8b77\u3001\u66f4\u5feb\u7684\u90e8\u7f72--\u8b93\u5b83\u8b8a\u5f97\u503c\u5f97\u3002\u4f7f\u7528 PHPUnit \u548c Cypress \u7b49\u5de5\u5177\uff0c\u60a8\u53ef\u4ee5\u6db5\u84cb\u6e2c\u8a66\u7684\u4e0d\u540c\u5c64\u9762\uff0c\u4e26\u78ba\u4fdd\u958b\u767c\u4eba\u54e1\u548c\u4f7f\u7528\u8005\u90fd\u80fd\u4eab\u6709\u9806\u66a2\u7684\u9ad4\u9a57\u3002\u5176\u4ed6\u5de5\u5177\u4e5f\u503c\u5f97\u8003\u616e\uff0c\u4f8b\u5982\u7528\u65bc\u6e2c\u8a66 JavaScript \u5143\u4ef6\u7684 Jest \u6216\u7528\u65bc\u66f4\u5168\u9762\u7684\u700f\u89bd\u5668\u81ea\u52d5\u5316\u6e2c\u8a66\u7684 Selenium\u3002<\/p><p>\u900f\u904e\u5efa\u7acb\u7a69\u56fa\u7684\u6e2c\u8a66\u5957\u4ef6\u4e26\u5c07\u5176\u6574\u5408\u5230 CI\/CD \u7ba1\u9053\u4e2d\uff0c\u60a8\u5c31\u53ef\u4ee5\u653e\u5fc3\u5730\u767c\u4f48\u529f\u80fd\uff0c\u56e0\u70ba\u60a8\u77e5\u9053\u6bcf\u4e00\u500b\u7a0b\u5f0f\u78bc\u90fd\u7d93\u904e\u5fb9\u5e95\u7684\u6aa2\u67e5\u3002\u81ea\u52d5\u5316\u6e2c\u8a66\u4e0d\u53ea\u662f\u82b1\u4fcf\u7684\u5de5\u5177\uff0c\u800c\u662f\u4efb\u4f55\u73fe\u4ee3\u958b\u767c\u5de5\u4f5c\u6d41\u7a0b\u7684\u652f\u67f1\u3002<\/p><p><\/p>","protected":false},"excerpt":{"rendered":"<p>\u5c0d WordPress \u958b\u767c\u4eba\u54e1\u4f86\u8aaa\uff0c\u81ea\u52d5\u5316\u6e2c\u8a66\u53ef\u80fd\u6703\u8b93\u4ed6\u5011\u611f\u5230\u754f\u61fc\uff0c\u4e3b\u8981\u662f\u5982\u679c\u60a8\u5f9e\u672a\u8655\u7406\u904e\u81ea\u52d5\u5316\u6e2c\u8a66\u7684\u8a71\u3002\u60a8\u53ef\u4ee5\u5c07\u5b83\u60f3\u50cf\u6210\u5728\u57f7\u884c\u6e2c\u8a66\u6642\u7684\u5b89\u5168\u7db2\u3002<\/p>","protected":false},"author":31,"featured_media":3318,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[207,298,206],"class_list":["post-3279","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automatic-management","tag-automated-testing","tag-ci-cd-integration","tag-wordpress-development",""],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/posts\/3279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/comments?post=3279"}],"version-history":[{"count":9,"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/posts\/3279\/revisions"}],"predecessor-version":[{"id":3323,"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/posts\/3279\/revisions\/3323"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/media\/3318"}],"wp:attachment":[{"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/media?parent=3279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/categories?post=3279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.openbyt.com\/zh\/wp-json\/wp\/v2\/tags?post=3279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}